xref: /illumos-gate/usr/src/cmd/eqn/funny.c (revision 2a8bcb4e)
1 /*
2  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
3  * Use is subject to license terms.
4  */
5 
6 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
7 /*	  All Rights Reserved  	*/
8 
9 /*
10  * Copyright (c) 1980 Regents of the University of California.
11  * All rights reserved. The Berkeley software License Agreement
12  * specifies the terms and conditions for redistribution.
13  */
14 
15 #include "e.h"
16 #include "e.def"
17 #include <locale.h>
18 
19 void
funny(int n)20 funny(int n)
21 {
22 	char *f;
23 
24 	yyval = oalloc();
25 	switch (n) {
26 	case SUM:
27 		f = "\\(*S"; break;
28 	case UNION:
29 		f = "\\(cu"; break;
30 	case INTER:	/* intersection */
31 		f = "\\(ca"; break;
32 	case PROD:
33 		f = "\\(*P"; break;
34 	default:
35 		(void) error(FATAL, gettext("funny type %d in funny"), n);
36 	}
37 #ifndef NEQN
38 	printf(".ds %d \\s%d\\v'.3m'\\s+5%s\\s-5\\v'-.3m'\\s%d\n",
39 	    yyval, ps, f, ps);
40 	eht[yyval] = VERT(EM(1.0, ps+5) - EM(0.2, ps));
41 	ebase[yyval] = VERT(EM(0.3, ps));
42 #else	/* NEQN */
43 	printf(".ds %d %s\n", yyval, f);
44 	eht[yyval] = VERT(2);
45 	ebase[yyval] = 0;
46 #endif	/* NEQN */
47 	if (dbg)
48 		printf(".\tfunny: S%d <- %s; h=%d b=%d\n",
49 		    yyval, f, eht[yyval], ebase[yyval]);
50 	lfont[yyval] = rfont[yyval] = ROM;
51 }
52