xref: /plan9/sys/src/cmd/eqn/integral.c (revision 3e12c5d1bb89fc02707907988834ef147769ddaf)
1 #include "e.h"
2 #include "y.tab.h"
3 
4 extern int Intps;
5 extern double Intht, Intbase, Int1h, Int1v, Int2h, Int2v;
6 
integral(int p,int p1,int p2)7 void integral(int p, int p1, int p2)
8 {
9 	if (p1 != 0)
10 		printf(".ds %d \\h'%gm'\\v'%gm'\\*(%d\\v'%gm'\n", p1, -Int1h, Int1v, p1, -Int1v);
11 	if (p2 != 0)
12 		printf(".ds %d \\v'%gm'\\h'%gm'\\*(%d\\v'%gm'\n", p2, -Int2v, Int2h, p2, Int2v);
13 	if (p1 != 0 && p2 != 0)
14 		shift2(p, p1, p2);
15 	else if (p1 != 0)
16 		bshiftb(p, SUB, p1);
17 	else if (p2 != 0)
18 		bshiftb(p, SUP, p2);
19 	dprintf(".\tintegral: S%d; h=%g b=%g\n", p, eht[p], ebase[p]);
20 	lfont[p] = ROM;
21 }
22 
setintegral(void)23 void setintegral(void)
24 {
25 	yyval = salloc();
26 	printf(".ds %d %s\n", yyval, lookup(deftbl, "int_def")->cval);
27 	eht[yyval] = EM(Intht, ps+Intps);
28 	ebase[yyval] = EM(Intbase, ps);
29 	lfont[yyval] = rfont[yyval] = ROM;
30 }
31