xref: /original-bsd/old/eqn/common_source/eqnbox.c (revision 9ad5198e)
1 /*-
2  * Copyright (c) 1991 The Regents of the University of California.
3  * All rights reserved.
4  *
5  * %sccs.include.proprietary.c%
6  */
7 
8 #ifndef lint
9 static char sccsid[] = "@(#)eqnbox.c	4.3 (Berkeley) 04/17/91";
10 #endif /* not lint */
11 
12 # include "e.h"
13 
14 eqnbox(p1, p2, lu) {
15 	int b, h;
16 	char *sh;
17 
18 	yyval = p1;
19 	b = max(ebase[p1], ebase[p2]);
20 	eht[yyval] = h = b + max(eht[p1]-ebase[p1],
21 		eht[p2]-ebase[p2]);
22 	ebase[yyval] = b;
23 	if(dbg)printf(".\te:eb: S%d <- S%d S%d; b=%d, h=%d\n",
24 		yyval, p1, p2, b, h);
25 	if (rfont[p1] == ITAL && lfont[p2] == ROM)
26 		sh = "\\|";
27 	else
28 		sh = "";
29 	if (lu) {
30 		printf(".nr %d \\w'\\s%d\\*(%d%s'\n", p1, ps, p1, sh);
31 		printf(".ds %d \\h'|\\n(97u-\\n(%du'\\*(%d\n", p1, p1, p1);
32 	}
33 	printf(".as %d \"%s\\*(%d\n", yyval, sh, p2);
34 	rfont[p1] = rfont[p2];
35 	ofree(p2);
36 }
37