1*48252Sbostic /*-
2*48252Sbostic  * Copyright (c) 1991 The Regents of the University of California.
3*48252Sbostic  * All rights reserved.
4*48252Sbostic  *
5*48252Sbostic  * %sccs.include.proprietary.c%
6*48252Sbostic  */
7*48252Sbostic 
814485Ssam #ifndef lint
9*48252Sbostic static char sccsid[] = "@(#)diacrit.c	4.4 (Berkeley) 04/17/91";
10*48252Sbostic #endif /* not lint */
1110998Sshannon 
1210998Sshannon # include "e.h"
1310998Sshannon # include "e.def"
1410998Sshannon 
diacrit(p1,type)1510998Sshannon diacrit(p1, type) int p1, type; {
1611023Sshannon 	int c, t;
1711023Sshannon #ifndef NEQN
1811023Sshannon 	int effps;
1911023Sshannon #endif NEQN
2010998Sshannon 
2110998Sshannon 	c = oalloc();
2210998Sshannon 	t = oalloc();
2311023Sshannon #ifdef NEQN
2411023Sshannon 	nrwid(p1, ps, p1);
2511023Sshannon 	printf(".nr 10 %du\n", max(eht[p1]-ebase[p1]-VERT(2),0));
2611023Sshannon #else NEQN
2710998Sshannon 	effps = EFFPS(ps);
2810998Sshannon 	nrwid(p1, effps, p1);
2910998Sshannon 	printf(".nr 10 %du\n", VERT(max(eht[p1]-ebase[p1]-6*ps,0)));	/* vertical shift if high */
3010998Sshannon 	printf(".if \\n(ct>1 .nr 10 \\n(10+\\s%d.25m\\s0\n", effps);
3110998Sshannon 	printf(".nr %d \\s%d.1m\\s0\n", t, effps);	/* horiz shift if high */
3210998Sshannon 	printf(".if \\n(ct>1 .nr %d \\s%d.15m\\s0\n", t, effps);
3311023Sshannon #endif NEQN
3410998Sshannon 	switch(type) {
3511023Sshannon 		case VEC:	/* vec */
3611023Sshannon #ifndef NEQN
3711023Sshannon 			printf(".ds %d \\v'-.4m'\\s%d\\(->\\s0\\v'.4m'\n",
3811023Sshannon 			    c, max(effps-3, 6));
3910998Sshannon 			break;
4011023Sshannon #endif NEQN
4111023Sshannon 		case DYAD:	/* dyad */
4211023Sshannon #ifdef NEQN
4311023Sshannon 			printf(".ds %d \\v'-1'_\\v'1'\n", c);
4411023Sshannon #else NEQN
4511023Sshannon 			printf(".ds %d \\v'-.4m'\\s%d\\z\\(<-\\(->\\s0\\v'.4m'\n",
4611023Sshannon 			    c, max(effps-3, 6));
4711023Sshannon #endif NEQN
4810998Sshannon 			break;
4910998Sshannon 		case HAT:
5010998Sshannon 			printf(".ds %d ^\n", c);
5110998Sshannon 			break;
5210998Sshannon 		case TILDE:
5310998Sshannon 			printf(".ds %d ~\n", c);
5410998Sshannon 			break;
5510998Sshannon 		case DOT:
5611023Sshannon #ifndef NEQN
5710998Sshannon 			printf(".ds %d \\s%d\\v'-.67m'.\\v'.67m'\\s0\n", c, effps);
5811023Sshannon #else NEQN
5911023Sshannon 			printf(".ds %d \\v'-1'.\\v'1'\n", c);
6011023Sshannon #endif NEQN
6110998Sshannon 			break;
6210998Sshannon 		case DOTDOT:
6311023Sshannon #ifndef NEQN
6410998Sshannon 			printf(".ds %d \\s%d\\v'-.67m'..\\v'.67m\\s0'\n", c, effps);
6511023Sshannon #else NEQN
6611023Sshannon 			printf(".ds %d \\v'-1'..\\v'1'\n", c);
6711023Sshannon #endif NEQN
6810998Sshannon 			break;
6910998Sshannon 		case BAR:
7011023Sshannon #ifndef NEQN
7110998Sshannon 			printf(".ds %d \\s%d\\v'.18m'\\h'.05m'\\l'\\n(%du-.1m\\(rn'\\h'.05m'\\v'-.18m'\\s0\n",
7210998Sshannon 				c, effps, p1);
7311023Sshannon #else NEQN
7411023Sshannon 			printf(".ds %d \\v'-1'\\l'\\n(%du'\\v'1'\n",
7511023Sshannon 				c, p1);
7611023Sshannon #endif NEQN
7710998Sshannon 			break;
7810998Sshannon 		case UNDER:
7911023Sshannon #ifndef NEQN
8010998Sshannon 			printf(".ds %d \\l'\\n(%du\\(ul'\n", c, p1);
8110998Sshannon 			printf(".nr %d 0\n", t);
8210998Sshannon 			printf(".nr 10 0-%d\n", ebase[p1]);
8311023Sshannon #else NEQN
8411023Sshannon 			printf(".ds %d \\l'\\n(%du'\n", c, p1);
8511023Sshannon #endif NEQN
8610998Sshannon 			break;
8710998Sshannon 		}
8810998Sshannon 	nrwid(c, ps, c);
8911023Sshannon #ifndef NEQN
9010998Sshannon 	if (lfont[p1] != ITAL)
9110998Sshannon 		printf(".nr %d 0\n", t);
9210998Sshannon 	printf(".as %d \\h'-\\n(%du-\\n(%du/2u+\\n(%du'\\v'0-\\n(10u'\\*(%d",
9310998Sshannon 		p1, p1, c, t, c);
9410998Sshannon 	printf("\\v'\\n(10u'\\h'-\\n(%du+\\n(%du/2u-\\n(%du'\n", c, p1, t);
9510998Sshannon 	/* BUG - should go to right end of widest */
9611023Sshannon #else NEQN
9711023Sshannon 	printf(".as %d \\h'-\\n(%du-\\n(%du/2u'\\v'0-\\n(10u'\\*(%d",
9811023Sshannon 		p1, p1, c, c);
9911023Sshannon 	printf("\\v'\\n(10u'\\h'-\\n(%du+\\n(%du/2u'\n", c, p1);
10011023Sshannon #endif NEQN
10111023Sshannon #ifndef NEQN
10210998Sshannon 	if (type != UNDER)
10310998Sshannon 		eht[p1] += VERT( (6*ps*15) / 100);	/* 0.15m */
10410998Sshannon 	if(dbg)printf(".\tdiacrit: %c over S%d, lf=%c, rf=%c, h=%d,b=%d\n",
10510998Sshannon 		type, p1, lfont[p1], rfont[p1], eht[p1], ebase[p1]);
10611023Sshannon #else NEQN
10711023Sshannon 	if (type != UNDER)
10811023Sshannon 		eht[p1] += VERT(1);
10911023Sshannon 	if (dbg) printf(".\tdiacrit: %c over S%d, h=%d, b=%d\n", type, p1, eht[p1], ebase[p1]);
11011023Sshannon #endif NEQN
11110998Sshannon 	ofree(c); ofree(t);
11210998Sshannon }
113