xref: /illumos-gate/usr/src/cmd/eqn/eqnbox.c (revision fc910014e8a32a65612105835a10995f2c13d942)
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 #include "e.h"
16 
17 void
18 eqnbox(int p1, int p2, int lu)
19 {
20 	int b, h;
21 	char *sh;
22 
23 	yyval = p1;
24 	b = max(ebase[p1], ebase[p2]);
25 	eht[yyval] = h = b + max(eht[p1]-ebase[p1], eht[p2]-ebase[p2]);
26 	ebase[yyval] = b;
27 	if (dbg)
28 		printf(".\te:eb: S%d <- S%d S%d; b=%d, h=%d\n",
29 		    yyval, p1, p2, b, h);
30 	if (rfont[p1] == ITAL && lfont[p2] == ROM)
31 		sh = "\\|";
32 	else
33 		sh = "";
34 	if (lu) {
35 		printf(".nr %d \\w'\\s%d\\*(%d%s'\n", p1, ps, p1, sh);
36 		printf(".ds %d \\h'|\\n(97u-\\n(%du'\\*(%d\n", p1, p1, p1);
37 	}
38 	printf(".as %d \"%s\\*(%d\n", yyval, sh, p2);
39 	rfont[p1] = rfont[p2];
40 	ofree(p2);
41 }
42