1 #ifndef lint
2 static char sccsid[] = "@(#)diacrit.c	2.2 (CWI) 87/04/01";
3 #endif lint
4 #include "e.h"
5 #include "y.tab.h"
6 
7 extern float Dvshift, Dhshift, Dh2shift, Dheight, Barv, Barh;
8 extern char *Vec, *Dyad, *Hat, *Tilde, *Dot, *Dotdot, *Utilde;
9 
10 diacrit(p1, type)
11 	int p1, type;
12 {
13 	int c, t;
14 
15 	c = salloc();
16 	t = salloc();
17 	nrwid(p1, ps, p1);
18 	printf(".nr 10 %gm\n", max(REL(eht[p1]-ebase[p1]-1,ps), 0));	/* vert shift if high */
19 	if (type == HIGHBAR)
20 		printf(".nr 10 \\n(10+%gm\n", Dvshift);
21 	else if (type == LOWBAR)
22 		printf(".nr 10 0\n");
23 	else
24 		printf(".if \\n(ct>1 .nr 10 \\n(10+%gm\n", Dvshift);
25 	printf(".nr %d %gm\n", t, Dhshift);	/* horiz shift if high */
26 	printf(".if \\n(ct>1 .nr %d %gm\n", t, Dh2shift);	/* was .1 and .15 */
27 	switch (type) {
28 	case VEC:
29 		printf(".ds %d %s\n", c, Vec);
30 		break;
31 	case DYAD:
32 		printf(".ds %d %s\n", c, Dyad);
33 		break;
34 	case HAT:
35 		printf(".ds %d %s\n", c, Hat);
36 		break;
37 	case TILDE:
38 		printf(".ds %d %s\n", c, Tilde);
39 		break;
40 	case DOT:
41 		printf(".ds %d %s\n", c, Dot);
42 		break;
43 	case DOTDOT:
44 		printf(".ds %d %s\n", c, Dotdot);
45 		break;
46 	case BAR:
47 	case LOWBAR:
48 	case HIGHBAR:
49 		printf(".ds %d \\v'%gm'\\h'%gm'\\l'\\n(%du-%gm'\\h'%gm'\\v'%gm'\n",
50 			c, -Barv, Barh, p1, 2*Barh, Barh, Barv);
51 		break;
52 	case UNDER:
53 		printf(".ds %d \\l'\\n(%du\\(ul'\n", c, p1);
54 		printf(".nr %d 0\n", t);
55 		printf(".nr 10 0-.1m-%gm\n", REL(ebase[p1],ps));
56 		printf(".if \\n(ct%%2=1 .nr 10 0\\n(10-.25m\n");
57 		break;
58 	case UTILDE:
59 		printf(".ds %d %s\n", c, Utilde);
60 		printf(".nr %d 0\n", t);
61 		printf(".nr 10 0-%gm\n", REL(ebase[p1],ps));
62 		printf(".if \\n(ct%%2=1 .nr 10 0\\n(10-%gm\n", Dvshift);
63 		break;
64 	}
65 	nrwid(c, ps, c);
66 	if (lfont[p1] != ITAL)
67 		printf(".nr %d 0\n", t);
68 	printf(".as %d \\h'-\\n(%du-\\n(%du/2u+\\n(%du'\\v'0-\\n(10u'\\*(%d",
69 		p1, p1, c, t, c);
70 	printf("\\v'\\n(10u'\\h'-\\n(%du+\\n(%du/2u-\\n(%du'\n", c, p1, t);
71 	if (type != UNDER && type != UTILDE)
72 		eht[p1] += EM(Dheight, ps);	/* was .15 */
73 	dprintf(".\tdiacrit: %c over S%d, lf=%c, rf=%c, h=%g, b=%g\n",
74 		type, p1, lfont[p1], rfont[p1], eht[p1], ebase[p1]);
75 	sfree(c); sfree(t);
76 }
77