1 /* $MirOS: src/usr.bin/oldroff/neqn/over.c,v 1.2 2008/11/08 23:04:37 tg Exp $ */
2
3 /*-
4 * Copyright (c) 1979, 1980, 1981, 1986, 1988, 1990, 1991, 1992
5 * The Regents of the University of California.
6 * Copyright (C) Caldera International Inc. 2001-2002.
7 * Copyright (c) 2003, 2004
8 * Thorsten "mirabilos" Glaser <tg@mirbsd.org>
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms,
12 * with or without modification, are permitted provided
13 * that the following conditions are met:
14 *
15 * Redistributions of source code and documentation must retain
16 * the above copyright notice, this list of conditions and the
17 * following disclaimer. Redistributions in binary form must
18 * reproduce the above copyright notice, this list of conditions
19 * and the following disclaimer in the documentation and/or other
20 * materials provided with the distribution.
21 *
22 * All advertising materials mentioning features or use of this
23 * software must display the following acknowledgement:
24 * This product includes software developed or owned by
25 * Caldera International, Inc.
26 *
27 * Neither the name of Caldera International, Inc. nor the names
28 * of other contributors may be used to endorse or promote products
29 * derived from this software without specific prior written permission.
30 *
31 * USE OF THE SOFTWARE PROVIDED FOR UNDER THIS LICENSE BY CALDERA
32 * INTERNATIONAL, INC. AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
33 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
34 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
35 * ARE DISCLAIMED. IN NO EVENT SHALL CALDERA INTERNATIONAL, INC. BE
36 * LIABLE FOR ANY DIRECT, INDIRECT INCIDENTAL, SPECIAL, EXEMPLARY, OR
37 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
38 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
39 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
40 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
41 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
42 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
43 */
44
45 #ifndef lint
46 static char sccsid[] = "@(#)over.c 4.4 (Berkeley) 4/17/91";
47 #endif
48
49 # include "e.h"
50
boverb(p1,p2)51 boverb(p1, p2) int p1, p2; {
52 int h, b, treg, d;
53
54 treg = oalloc();
55 yyval = p1;
56 #ifndef NEQN
57 d = VERT((ps*6*3) / 10); /* 0.3m */
58 h = eht[p1] + eht[p2] + d;
59 #else
60 d = VERT(1);
61 h = eht[p1] + eht[p2];
62 #endif
63 b = eht[p2] - d;
64 if(dbg)printf(".\tb:bob: S%d <- S%d over S%d; b=%d, h=%d\n",
65 yyval, p1, p2, b, h);
66 nrwid(p1, ps, p1);
67 nrwid(p2, ps, p2);
68 printf(".nr %d \\n(%d\n", treg, p1);
69 printf(".if \\n(%d>\\n(%d .nr %d \\n(%d\n", p2, treg, treg, p2);
70 #ifndef NEQN
71 printf(".nr %d \\n(%d+\\s%d.5m\\s0\n", treg, treg, EFFPS(ps));
72 #endif
73 printf(".ds %d \\v'%du'\\h'\\n(%du-\\n(%du/2u'\\*(%d\\\n",
74 yyval, eht[p2]-ebase[p2]-d, treg, p2, p2);
75 printf("\\h'-\\n(%du-\\n(%du/2u'\\v'%du'\\*(%d\\\n",
76 #ifndef NEQN
77 p2, p1, -(eht[p2]-ebase[p2]+d+ebase[p1]), p1);
78 printf("\\h'-\\n(%du-\\n(%du/2u+.1m'\\v'%du'\\l'\\n(%du-.2m'\\h'.1m'\\v'%du'\n",
79 treg, p1, ebase[p1]+d, treg, d);
80 #else
81 p2, p1, -eht[p2]+ebase[p2]-ebase[p1], p1);
82 printf("\\h'-\\n(%du-\\n(%du-2u/2u'\\v'%du'\\l'\\n(%du'\\v'%du'\n",
83 treg, p1, ebase[p1], treg, d);
84 #endif
85 ebase[yyval] = b;
86 eht[yyval] = h;
87 lfont[yyval] = rfont[yyval] = 0;
88 ofree(p2);
89 ofree(treg);
90 }
91