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