1*779fc935Sceastha /*
2*779fc935Sceastha * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
3*779fc935Sceastha * Use is subject to license terms.
4*779fc935Sceastha */
5*779fc935Sceastha
67c478bd9Sstevel@tonic-gate /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
77c478bd9Sstevel@tonic-gate /* All Rights Reserved */
87c478bd9Sstevel@tonic-gate
97c478bd9Sstevel@tonic-gate /*
107c478bd9Sstevel@tonic-gate * Copyright (c) 1980 Regents of the University of California.
117c478bd9Sstevel@tonic-gate * All rights reserved. The Berkeley software License Agreement
127c478bd9Sstevel@tonic-gate * specifies the terms and conditions for redistribution.
137c478bd9Sstevel@tonic-gate */
147c478bd9Sstevel@tonic-gate
15*779fc935Sceastha #pragma ident "%Z%%M% %I% %E% SMI"
167c478bd9Sstevel@tonic-gate
177c478bd9Sstevel@tonic-gate #include "e.h"
187c478bd9Sstevel@tonic-gate #include "e.def"
197c478bd9Sstevel@tonic-gate
20*779fc935Sceastha void
diacrit(int p1,int type)21*779fc935Sceastha diacrit(int p1, int type)
22*779fc935Sceastha {
237c478bd9Sstevel@tonic-gate int c, t;
247c478bd9Sstevel@tonic-gate #ifndef NEQN
257c478bd9Sstevel@tonic-gate int effps;
26*779fc935Sceastha #endif /* NEQN */
277c478bd9Sstevel@tonic-gate
287c478bd9Sstevel@tonic-gate c = oalloc();
297c478bd9Sstevel@tonic-gate t = oalloc();
307c478bd9Sstevel@tonic-gate #ifdef NEQN
317c478bd9Sstevel@tonic-gate nrwid(p1, ps, p1);
327c478bd9Sstevel@tonic-gate printf(".nr 10 %du\n", max(eht[p1]-ebase[p1]-VERT(2), 0));
33*779fc935Sceastha #else /* NEQN */
347c478bd9Sstevel@tonic-gate effps = EFFPS(ps);
357c478bd9Sstevel@tonic-gate nrwid(p1, effps, p1);
36*779fc935Sceastha
37*779fc935Sceastha /* vertical shift if high */
38*779fc935Sceastha printf(".nr 10 %du\n", VERT(max(eht[p1]-ebase[p1]-EM(1, ps), 0)));
39*779fc935Sceastha
407c478bd9Sstevel@tonic-gate printf(".if \\n(ct>1 .nr 10 \\n(10+\\s%d.25m\\s0\n", effps);
41*779fc935Sceastha
42*779fc935Sceastha /* horiz shift if high */
43*779fc935Sceastha printf(".nr %d \\s%d.1m\\s0\n", t, effps);
44*779fc935Sceastha
457c478bd9Sstevel@tonic-gate printf(".if \\n(ct>1 .nr %d \\s%d.15m\\s0\n", t, effps);
46*779fc935Sceastha #endif /* NEQN */
477c478bd9Sstevel@tonic-gate switch (type) {
487c478bd9Sstevel@tonic-gate case VEC: /* vec */
497c478bd9Sstevel@tonic-gate #ifndef NEQN
507c478bd9Sstevel@tonic-gate printf(".ds %d \\v'-.4m'\\s%d\\(->\\s0\\v'.4m'\n",
517c478bd9Sstevel@tonic-gate c, max(effps-3, 6));
527c478bd9Sstevel@tonic-gate break;
53*779fc935Sceastha #endif /* NEQN */
547c478bd9Sstevel@tonic-gate case DYAD: /* dyad */
557c478bd9Sstevel@tonic-gate #ifdef NEQN
567c478bd9Sstevel@tonic-gate printf(".ds %d \\v'-12p'_\\v'12p'\n", c);
57*779fc935Sceastha #else /* NEQN */
58*779fc935Sceastha printf(
59*779fc935Sceastha ".ds %d \\v'-.4m'\\s%d\\z\\(<-\\(->\\s0\\v'.4m'\n",
607c478bd9Sstevel@tonic-gate c, max(effps-3, 6));
61*779fc935Sceastha #endif /* NEQN */
627c478bd9Sstevel@tonic-gate break;
637c478bd9Sstevel@tonic-gate case HAT:
647c478bd9Sstevel@tonic-gate printf(".ds %d ^\n", c);
657c478bd9Sstevel@tonic-gate break;
667c478bd9Sstevel@tonic-gate case TILDE:
677c478bd9Sstevel@tonic-gate printf(".ds %d ~\n", c);
687c478bd9Sstevel@tonic-gate break;
697c478bd9Sstevel@tonic-gate case DOT:
707c478bd9Sstevel@tonic-gate #ifndef NEQN
71*779fc935Sceastha printf(
72*779fc935Sceastha ".ds %d \\s%d\\v'-.67m'.\\v'.67m'\\s0\n", c, effps);
73*779fc935Sceastha #else /* NEQN */
747c478bd9Sstevel@tonic-gate printf(".ds %d \\v'-12p'.\\v'12p'\n", c);
75*779fc935Sceastha #endif /* NEQN */
767c478bd9Sstevel@tonic-gate break;
777c478bd9Sstevel@tonic-gate case DOTDOT:
787c478bd9Sstevel@tonic-gate #ifndef NEQN
79*779fc935Sceastha printf(
80*779fc935Sceastha ".ds %d \\s%d\\v'-.67m'..\\v'.67m\\s0'\n",
81*779fc935Sceastha c, effps);
82*779fc935Sceastha #else /* NEQN */
837c478bd9Sstevel@tonic-gate printf(".ds %d \\v'-12p'..\\v'12p'\n", c);
84*779fc935Sceastha #endif /* NEQN */
857c478bd9Sstevel@tonic-gate break;
867c478bd9Sstevel@tonic-gate case BAR:
877c478bd9Sstevel@tonic-gate #ifndef NEQN
88*779fc935Sceastha printf(".ds %d \\s%d\\v'.28m'\\h'.05m'\\l'\\n"
89*779fc935Sceastha "(%du-.1m\\(rn'\\h'.05m'\\v'-.28m'\\s0\n",
907c478bd9Sstevel@tonic-gate c, effps, p1);
91*779fc935Sceastha #else /* NEQN */
927c478bd9Sstevel@tonic-gate printf(".ds %d \\v'-12p'\\l'\\n(%du'\\v'12p'\n",
937c478bd9Sstevel@tonic-gate c, p1);
94*779fc935Sceastha #endif /* NEQN */
957c478bd9Sstevel@tonic-gate break;
967c478bd9Sstevel@tonic-gate case UNDER:
977c478bd9Sstevel@tonic-gate #ifndef NEQN
987c478bd9Sstevel@tonic-gate printf(".ds %d \\l'\\n(%du\\(ul'\n", c, p1);
997c478bd9Sstevel@tonic-gate printf(".nr %d 0\n", t);
1007c478bd9Sstevel@tonic-gate printf(".nr 10 0-%d\n", ebase[p1]);
101*779fc935Sceastha #else /* NEQN */
1027c478bd9Sstevel@tonic-gate printf(".ds %d \\l'\\n(%du'\n", c, p1);
103*779fc935Sceastha #endif /* NEQN */
1047c478bd9Sstevel@tonic-gate break;
1057c478bd9Sstevel@tonic-gate }
1067c478bd9Sstevel@tonic-gate nrwid(c, ps, c);
1077c478bd9Sstevel@tonic-gate #ifndef NEQN
1087c478bd9Sstevel@tonic-gate if (lfont[p1] != ITAL)
1097c478bd9Sstevel@tonic-gate printf(".nr %d 0\n", t);
1107c478bd9Sstevel@tonic-gate printf(".as %d \\h'-\\n(%du-\\n(%du/2u+\\n(%du'\\v'0-\\n(10u'\\*(%d",
1117c478bd9Sstevel@tonic-gate p1, p1, c, t, c);
1127c478bd9Sstevel@tonic-gate printf("\\v'\\n(10u'\\h'-\\n(%du+\\n(%du/2u-\\n(%du'\n", c, p1, t);
1137c478bd9Sstevel@tonic-gate /* BUG - should go to right end of widest */
114*779fc935Sceastha #else /* NEQN */
1157c478bd9Sstevel@tonic-gate printf(".as %d \\h'-\\n(%du-\\n(%du/2u'\\v'0-\\n(10u'\\*(%d",
1167c478bd9Sstevel@tonic-gate p1, p1, c, c);
1177c478bd9Sstevel@tonic-gate printf("\\v'\\n(10u'\\h'-\\n(%du+\\n(%du/2u'\n", c, p1);
118*779fc935Sceastha #endif /* NEQN */
1197c478bd9Sstevel@tonic-gate #ifndef NEQN
1207c478bd9Sstevel@tonic-gate if (type != UNDER)
1217c478bd9Sstevel@tonic-gate eht[p1] += VERT(EM(0.15, ps)); /* 0.15m */
122*779fc935Sceastha if (dbg)
123*779fc935Sceastha printf(".\tdiacrit: %c over S%d, lf=%c, rf=%c, h=%d,b=%d\n",
1247c478bd9Sstevel@tonic-gate type, p1, lfont[p1], rfont[p1], eht[p1], ebase[p1]);
125*779fc935Sceastha #else /* NEQN */
1267c478bd9Sstevel@tonic-gate if (type != UNDER)
1277c478bd9Sstevel@tonic-gate eht[p1] += VERT(1);
128*779fc935Sceastha if (dbg)
129*779fc935Sceastha printf(".\tdiacrit: %c over S%d, h=%d, b=%d\n",
130*779fc935Sceastha type, p1, eht[p1], ebase[p1]);
131*779fc935Sceastha #endif /* NEQN */
1327c478bd9Sstevel@tonic-gate ofree(c); ofree(t);
1337c478bd9Sstevel@tonic-gate }
134