1 /*	diacrit.c	4.2	83/02/12	*/
2 
3 # include "e.h"
4 # include "e.def"
5 
6 diacrit(p1, type) int p1, type; {
7 	int c, t;
8 #ifndef NEQN
9 	int effps;
10 #endif NEQN
11 
12 	c = oalloc();
13 	t = oalloc();
14 #ifdef NEQN
15 	nrwid(p1, ps, p1);
16 	printf(".nr 10 %du\n", max(eht[p1]-ebase[p1]-VERT(2),0));
17 #else NEQN
18 	effps = EFFPS(ps);
19 	nrwid(p1, effps, p1);
20 	printf(".nr 10 %du\n", VERT(max(eht[p1]-ebase[p1]-6*ps,0)));	/* vertical shift if high */
21 	printf(".if \\n(ct>1 .nr 10 \\n(10+\\s%d.25m\\s0\n", effps);
22 	printf(".nr %d \\s%d.1m\\s0\n", t, effps);	/* horiz shift if high */
23 	printf(".if \\n(ct>1 .nr %d \\s%d.15m\\s0\n", t, effps);
24 #endif NEQN
25 	switch(type) {
26 		case VEC:	/* vec */
27 #ifndef NEQN
28 			printf(".ds %d \\v'-.4m'\\s%d\\(->\\s0\\v'.4m'\n",
29 			    c, max(effps-3, 6));
30 			break;
31 #endif NEQN
32 		case DYAD:	/* dyad */
33 #ifdef NEQN
34 			printf(".ds %d \\v'-1'_\\v'1'\n", c);
35 #else NEQN
36 			printf(".ds %d \\v'-.4m'\\s%d\\z\\(<-\\(->\\s0\\v'.4m'\n",
37 			    c, max(effps-3, 6));
38 #endif NEQN
39 			break;
40 		case HAT:
41 			printf(".ds %d ^\n", c);
42 			break;
43 		case TILDE:
44 			printf(".ds %d ~\n", c);
45 			break;
46 		case DOT:
47 #ifndef NEQN
48 			printf(".ds %d \\s%d\\v'-.67m'.\\v'.67m'\\s0\n", c, effps);
49 #else NEQN
50 			printf(".ds %d \\v'-1'.\\v'1'\n", c);
51 #endif NEQN
52 			break;
53 		case DOTDOT:
54 #ifndef NEQN
55 			printf(".ds %d \\s%d\\v'-.67m'..\\v'.67m\\s0'\n", c, effps);
56 #else NEQN
57 			printf(".ds %d \\v'-1'..\\v'1'\n", c);
58 #endif NEQN
59 			break;
60 		case BAR:
61 #ifndef NEQN
62 			printf(".ds %d \\s%d\\v'.18m'\\h'.05m'\\l'\\n(%du-.1m\\(rn'\\h'.05m'\\v'-.18m'\\s0\n",
63 				c, effps, p1);
64 #else NEQN
65 			printf(".ds %d \\v'-1'\\l'\\n(%du'\\v'1'\n",
66 				c, p1);
67 #endif NEQN
68 			break;
69 		case UNDER:
70 #ifndef NEQN
71 			printf(".ds %d \\l'\\n(%du\\(ul'\n", c, p1);
72 			printf(".nr %d 0\n", t);
73 			printf(".nr 10 0-%d\n", ebase[p1]);
74 #else NEQN
75 			printf(".ds %d \\l'\\n(%du'\n", c, p1);
76 #endif NEQN
77 			break;
78 		}
79 	nrwid(c, ps, c);
80 #ifndef NEQN
81 	if (lfont[p1] != ITAL)
82 		printf(".nr %d 0\n", t);
83 	printf(".as %d \\h'-\\n(%du-\\n(%du/2u+\\n(%du'\\v'0-\\n(10u'\\*(%d",
84 		p1, p1, c, t, c);
85 	printf("\\v'\\n(10u'\\h'-\\n(%du+\\n(%du/2u-\\n(%du'\n", c, p1, t);
86 	/* BUG - should go to right end of widest */
87 #else NEQN
88 	printf(".as %d \\h'-\\n(%du-\\n(%du/2u'\\v'0-\\n(10u'\\*(%d",
89 		p1, p1, c, c);
90 	printf("\\v'\\n(10u'\\h'-\\n(%du+\\n(%du/2u'\n", c, p1);
91 #endif NEQN
92 #ifndef NEQN
93 	if (type != UNDER)
94 		eht[p1] += VERT( (6*ps*15) / 100);	/* 0.15m */
95 	if(dbg)printf(".\tdiacrit: %c over S%d, lf=%c, rf=%c, h=%d,b=%d\n",
96 		type, p1, lfont[p1], rfont[p1], eht[p1], ebase[p1]);
97 #else NEQN
98 	if (type != UNDER)
99 		eht[p1] += VERT(1);
100 	if (dbg) printf(".\tdiacrit: %c over S%d, h=%d, b=%d\n", type, p1, eht[p1], ebase[p1]);
101 #endif NEQN
102 	ofree(c); ofree(t);
103 }
104