xref: /illumos-gate/usr/src/cmd/eqn/integral.c (revision a57549b4a2006e67bc7e247816f7ccd7fb62fce6)
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 #include "e.def"
17 
18 void
19 integral(int p, int p1, int p2)
20 {
21 #ifndef	NEQN
22 	if (p1 != 0)
23 		printf(".ds %d \\h'-0.4m'\\v'0.4m'\\*(%d\\v'-0.4m'\n", p1, p1);
24 	if (p2 != 0)
25 		printf(".ds %d \\v'-0.3m'\\*(%d\\v'0.3m'\n", p2, p2);
26 #endif
27 	if (p1 != 0 && p2 != 0)
28 		shift2(p, p1, p2);
29 	else if (p1 != 0)
30 		bshiftb(p, SUB, p1);
31 	else if (p2 != 0)
32 		bshiftb(p, SUP, p2);
33 	if (dbg)
34 		printf(".\tintegral: S%d; h=%d b=%d\n",
35 		    p, eht[p], ebase[p]);
36 	lfont[p] = ROM;
37 }
38 
39 void
40 setintegral(void)
41 {
42 	char *f;
43 
44 	yyval = oalloc();
45 	f = "\\(is";
46 #ifndef NEQN
47 	printf(".ds %d \\s%d\\v'.1m'\\s+4%s\\s-4\\v'-.1m'\\s%d\n",
48 	    yyval, ps, f, ps);
49 	eht[yyval] = VERT(EM(1.15, ps+4));
50 	ebase[yyval] = VERT(EM(0.3, ps));
51 #else	/* NEQN */
52 	printf(".ds %d %s\n", yyval, f);
53 	eht[yyval] = VERT(2);
54 	ebase[yyval] = 0;
55 #endif	/* NEQN */
56 	lfont[yyval] = rfont[yyval] = ROM;
57 }
58