xref: /titanic_50/usr/src/cmd/eqn/eqnbox.c (revision 5aefb6555731130ca4fd295960123d71f2d21fe8)
1 /*
2  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
3  * Use is subject to license terms.
4  */
5 
6 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
7 /*	  All Rights Reserved  	*/
8 
9 /*
10  * Copyright (c) 1980 Regents of the University of California.
11  * All rights reserved. The Berkeley software License Agreement
12  * specifies the terms and conditions for redistribution.
13  */
14 
15 #pragma ident	"%Z%%M%	%I%	%E% SMI"
16 
17 #include "e.h"
18 
19 void
20 eqnbox(int p1, int p2, int lu)
21 {
22 	int b, h;
23 	char *sh;
24 
25 	yyval = p1;
26 	b = max(ebase[p1], ebase[p2]);
27 	eht[yyval] = h = b + max(eht[p1]-ebase[p1], eht[p2]-ebase[p2]);
28 	ebase[yyval] = b;
29 	if (dbg)
30 		printf(".\te:eb: S%d <- S%d S%d; b=%d, h=%d\n",
31 		    yyval, p1, p2, b, h);
32 	if (rfont[p1] == ITAL && lfont[p2] == ROM)
33 		sh = "\\|";
34 	else
35 		sh = "";
36 	if (lu) {
37 		printf(".nr %d \\w'\\s%d\\*(%d%s'\n", p1, ps, p1, sh);
38 		printf(".ds %d \\h'|\\n(97u-\\n(%du'\\*(%d\n", p1, p1, p1);
39 	}
40 	printf(".as %d \"%s\\*(%d\n", yyval, sh, p2);
41 	rfont[p1] = rfont[p2];
42 	ofree(p2);
43 }
44