BSD 4_3_Tahoe release
[unix-history] / usr / src / usr.bin / eqn / common_source / diacrit.c
CommitLineData
f6227721 1#ifndef lint
0f4556f1 2static char sccsid[] = "@(#)diacrit.c 4.3 8/11/83";
f6227721 3#endif
b6f488d0
BS
4
5# include "e.h"
6# include "e.def"
7
8diacrit(p1, type) int p1, type; {
6f1a2a65
BS
9 int c, t;
10#ifndef NEQN
11 int effps;
12#endif NEQN
b6f488d0
BS
13
14 c = oalloc();
15 t = oalloc();
6f1a2a65
BS
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
b6f488d0
BS
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);
6f1a2a65 26#endif NEQN
b6f488d0 27 switch(type) {
6f1a2a65
BS
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));
b6f488d0 32 break;
6f1a2a65
BS
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
b6f488d0
BS
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:
6f1a2a65 49#ifndef NEQN
b6f488d0 50 printf(".ds %d \\s%d\\v'-.67m'.\\v'.67m'\\s0\n", c, effps);
6f1a2a65
BS
51#else NEQN
52 printf(".ds %d \\v'-1'.\\v'1'\n", c);
53#endif NEQN
b6f488d0
BS
54 break;
55 case DOTDOT:
6f1a2a65 56#ifndef NEQN
b6f488d0 57 printf(".ds %d \\s%d\\v'-.67m'..\\v'.67m\\s0'\n", c, effps);
6f1a2a65
BS
58#else NEQN
59 printf(".ds %d \\v'-1'..\\v'1'\n", c);
60#endif NEQN
b6f488d0
BS
61 break;
62 case BAR:
6f1a2a65 63#ifndef NEQN
b6f488d0
BS
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);
6f1a2a65
BS
66#else NEQN
67 printf(".ds %d \\v'-1'\\l'\\n(%du'\\v'1'\n",
68 c, p1);
69#endif NEQN
b6f488d0
BS
70 break;
71 case UNDER:
6f1a2a65 72#ifndef NEQN
b6f488d0
BS
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]);
6f1a2a65
BS
76#else NEQN
77 printf(".ds %d \\l'\\n(%du'\n", c, p1);
78#endif NEQN
b6f488d0
BS
79 break;
80 }
81 nrwid(c, ps, c);
6f1a2a65 82#ifndef NEQN
b6f488d0
BS
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 */
6f1a2a65
BS
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
b6f488d0
BS
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]);
6f1a2a65
BS
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
b6f488d0
BS
104 ofree(c); ofree(t);
105}