xref: /titanic_53/usr/src/cmd/troff/nroff.d/n6.c (revision e5190c108bde19ca4d7c03b1d1eab7b00bd3a1ed)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
57c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
67c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
77c478bd9Sstevel@tonic-gate  * with the License.
87c478bd9Sstevel@tonic-gate  *
97c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate  * and limitations under the License.
137c478bd9Sstevel@tonic-gate  *
147c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate  *
207c478bd9Sstevel@tonic-gate  * CDDL HEADER END
217c478bd9Sstevel@tonic-gate  */
227c478bd9Sstevel@tonic-gate /*
237c478bd9Sstevel@tonic-gate  * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
257c478bd9Sstevel@tonic-gate  */
267c478bd9Sstevel@tonic-gate 
277c478bd9Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
287c478bd9Sstevel@tonic-gate /*	  All Rights Reserved  	*/
297c478bd9Sstevel@tonic-gate 
307c478bd9Sstevel@tonic-gate /*
317c478bd9Sstevel@tonic-gate  * University Copyright- Copyright (c) 1982, 1986, 1988
327c478bd9Sstevel@tonic-gate  * The Regents of the University of California
337c478bd9Sstevel@tonic-gate  * All Rights Reserved
347c478bd9Sstevel@tonic-gate  *
357c478bd9Sstevel@tonic-gate  * University Acknowledgment- Portions of this document are derived from
367c478bd9Sstevel@tonic-gate  * software developed by the University of California, Berkeley, and its
377c478bd9Sstevel@tonic-gate  * contributors.
387c478bd9Sstevel@tonic-gate  */
397c478bd9Sstevel@tonic-gate 
40*e5190c10Smuffin #pragma ident	"%Z%%M%	%I%	%E% SMI"
41*e5190c10Smuffin 
427c478bd9Sstevel@tonic-gate #include "tdef.h"
437c478bd9Sstevel@tonic-gate #include "tw.h"
447c478bd9Sstevel@tonic-gate #include "ext.h"
457c478bd9Sstevel@tonic-gate #include <ctype.h>
467c478bd9Sstevel@tonic-gate 
477c478bd9Sstevel@tonic-gate /*
487c478bd9Sstevel@tonic-gate  * n6.c -- width functions, sizes and fonts
497c478bd9Sstevel@tonic-gate */
507c478bd9Sstevel@tonic-gate 
517c478bd9Sstevel@tonic-gate int	bdtab[NFONT+1] ={ 0, 0, 0, 3, 3, 0, };
527c478bd9Sstevel@tonic-gate int	sbold = 0;
537c478bd9Sstevel@tonic-gate int	fontlab[NFONT+1] = { 0, 'R', 'I', 'B', PAIR('B','I'), 'S', 0 };
547c478bd9Sstevel@tonic-gate 
557c478bd9Sstevel@tonic-gate extern	int	nchtab;
567c478bd9Sstevel@tonic-gate 
57*e5190c10Smuffin int
587c478bd9Sstevel@tonic-gate width(j)
59*e5190c10Smuffin tchar j;
607c478bd9Sstevel@tonic-gate {
61*e5190c10Smuffin 	int	i, k;
627c478bd9Sstevel@tonic-gate 
637c478bd9Sstevel@tonic-gate 	if (j & (ZBIT|MOT)) {
647c478bd9Sstevel@tonic-gate 		if (iszbit(j))
657c478bd9Sstevel@tonic-gate 			return(0);
667c478bd9Sstevel@tonic-gate 		if (isvmot(j))
677c478bd9Sstevel@tonic-gate 			return(0);
687c478bd9Sstevel@tonic-gate 		k = absmot(j);
697c478bd9Sstevel@tonic-gate 		if (isnmot(j))
707c478bd9Sstevel@tonic-gate 			k = -k;
717c478bd9Sstevel@tonic-gate 		return(k);
727c478bd9Sstevel@tonic-gate 	}
737c478bd9Sstevel@tonic-gate 	i = cbits(j);
747c478bd9Sstevel@tonic-gate 	if (i < ' ') {
757c478bd9Sstevel@tonic-gate 		if (i == '\b')
767c478bd9Sstevel@tonic-gate 			return(-widthp);
777c478bd9Sstevel@tonic-gate 		if (i == PRESC)
787c478bd9Sstevel@tonic-gate 			i = eschar;
797c478bd9Sstevel@tonic-gate 		else if (iscontrol(i))
807c478bd9Sstevel@tonic-gate 			return(0);
817c478bd9Sstevel@tonic-gate 	}
827c478bd9Sstevel@tonic-gate 	if (i==ohc)
837c478bd9Sstevel@tonic-gate 		return(0);
847c478bd9Sstevel@tonic-gate #ifdef EUC
857c478bd9Sstevel@tonic-gate #ifdef NROFF
867c478bd9Sstevel@tonic-gate 	if (multi_locale) {
877c478bd9Sstevel@tonic-gate 		if ((j & MBMASK) || (j & CSMASK)) {
887c478bd9Sstevel@tonic-gate 			switch(j & MBMASK) {
897c478bd9Sstevel@tonic-gate 				case BYTE_CHR:
907c478bd9Sstevel@tonic-gate 				case LASTOFMB:
917c478bd9Sstevel@tonic-gate 					k = t.Char * csi_width[cs(j)];
927c478bd9Sstevel@tonic-gate 					break;
937c478bd9Sstevel@tonic-gate 				default:
947c478bd9Sstevel@tonic-gate 					k = 0;
957c478bd9Sstevel@tonic-gate 					break;
967c478bd9Sstevel@tonic-gate 			}
977c478bd9Sstevel@tonic-gate 			widthp = k;
987c478bd9Sstevel@tonic-gate 			return(k);
997c478bd9Sstevel@tonic-gate 		}
1007c478bd9Sstevel@tonic-gate 	}
1017c478bd9Sstevel@tonic-gate 	i &= 0x1ff;
1027c478bd9Sstevel@tonic-gate #endif /* NROFF */
1037c478bd9Sstevel@tonic-gate #endif /* EUC */
1047c478bd9Sstevel@tonic-gate 	i = trtab[i];
1057c478bd9Sstevel@tonic-gate 	if (i < 32)
1067c478bd9Sstevel@tonic-gate 		return(0);
1077c478bd9Sstevel@tonic-gate 	k = t.width[i] * t.Char;
1087c478bd9Sstevel@tonic-gate 	widthp = k;
1097c478bd9Sstevel@tonic-gate 	return(k);
1107c478bd9Sstevel@tonic-gate }
1117c478bd9Sstevel@tonic-gate 
1127c478bd9Sstevel@tonic-gate 
1137c478bd9Sstevel@tonic-gate tchar setch()
1147c478bd9Sstevel@tonic-gate {
115*e5190c10Smuffin 	int	j;
1167c478bd9Sstevel@tonic-gate 	char	temp[10];
117*e5190c10Smuffin 	char	*s;
1187c478bd9Sstevel@tonic-gate 
1197c478bd9Sstevel@tonic-gate 	s = temp;
1207c478bd9Sstevel@tonic-gate 	if ((*s++ = getach()) == 0 || (*s++ = getach()) == 0)
1217c478bd9Sstevel@tonic-gate 		return(0);
1227c478bd9Sstevel@tonic-gate 	*s = '\0';
1237c478bd9Sstevel@tonic-gate 	if ((j = findch(temp)) > 0)
1247c478bd9Sstevel@tonic-gate 		return j | chbits;
1257c478bd9Sstevel@tonic-gate 	else
1267c478bd9Sstevel@tonic-gate 		return 0;
1277c478bd9Sstevel@tonic-gate }
1287c478bd9Sstevel@tonic-gate 
1297c478bd9Sstevel@tonic-gate tchar setabs()		/* set absolute char from \C'...' */
1307c478bd9Sstevel@tonic-gate {			/* for now, a no-op */
1317c478bd9Sstevel@tonic-gate 	int i, n, nf;
1327c478bd9Sstevel@tonic-gate 
1337c478bd9Sstevel@tonic-gate 	getch();
1347c478bd9Sstevel@tonic-gate 	n = 0;
1357c478bd9Sstevel@tonic-gate 	n = inumb(&n);
1367c478bd9Sstevel@tonic-gate 	getch();
1377c478bd9Sstevel@tonic-gate 	if (nonumb)
1387c478bd9Sstevel@tonic-gate 		return 0;
1397c478bd9Sstevel@tonic-gate 	return n + nchtab + _SPECCHAR_ST;
1407c478bd9Sstevel@tonic-gate }
1417c478bd9Sstevel@tonic-gate 
142*e5190c10Smuffin int
1437c478bd9Sstevel@tonic-gate findft(i)
144*e5190c10Smuffin int	i;
1457c478bd9Sstevel@tonic-gate {
146*e5190c10Smuffin 	int	k;
1477c478bd9Sstevel@tonic-gate 
1487c478bd9Sstevel@tonic-gate 	if ((k = i - '0') >= 0 && k <= nfonts && k < smnt)
1497c478bd9Sstevel@tonic-gate 		return(k);
1507c478bd9Sstevel@tonic-gate 	for (k = 0; fontlab[k] != i; k++)
1517c478bd9Sstevel@tonic-gate 		if (k > nfonts)
1527c478bd9Sstevel@tonic-gate 			return(-1);
1537c478bd9Sstevel@tonic-gate 	return(k);
1547c478bd9Sstevel@tonic-gate }
1557c478bd9Sstevel@tonic-gate 
156*e5190c10Smuffin int
1577c478bd9Sstevel@tonic-gate caseps()
1587c478bd9Sstevel@tonic-gate {
159*e5190c10Smuffin 	return (0);
1607c478bd9Sstevel@tonic-gate }
1617c478bd9Sstevel@tonic-gate 
162*e5190c10Smuffin int
1637c478bd9Sstevel@tonic-gate mchbits()
1647c478bd9Sstevel@tonic-gate {
1657c478bd9Sstevel@tonic-gate 	chbits = 0;
1667c478bd9Sstevel@tonic-gate 	setfbits(chbits, font);
1677c478bd9Sstevel@tonic-gate 	sps = width(' ' | chbits);
168*e5190c10Smuffin 
169*e5190c10Smuffin 	return (0);
1707c478bd9Sstevel@tonic-gate }
1717c478bd9Sstevel@tonic-gate 
1727c478bd9Sstevel@tonic-gate 
173*e5190c10Smuffin int
1747c478bd9Sstevel@tonic-gate setps()
1757c478bd9Sstevel@tonic-gate {
176*e5190c10Smuffin 	int	i, j;
1777c478bd9Sstevel@tonic-gate 
1787c478bd9Sstevel@tonic-gate 	i = cbits(getch());
1797c478bd9Sstevel@tonic-gate 	if (ischar(i) && isdigit(i)) {		/* \sd or \sdd */
1807c478bd9Sstevel@tonic-gate 		i -= '0';
1817c478bd9Sstevel@tonic-gate 		if (i == 0)		/* \s0 */
1827c478bd9Sstevel@tonic-gate 			;
1837c478bd9Sstevel@tonic-gate 		else if (i <= 3 && ischar(j = cbits(ch = getch())) &&
1847c478bd9Sstevel@tonic-gate 		    isdigit(j)) {	/* \sdd */
1857c478bd9Sstevel@tonic-gate 			ch = 0;
1867c478bd9Sstevel@tonic-gate 		}
1877c478bd9Sstevel@tonic-gate 	} else if (i == '(') {		/* \s(dd */
1887c478bd9Sstevel@tonic-gate 		getch();
1897c478bd9Sstevel@tonic-gate 		getch();
1907c478bd9Sstevel@tonic-gate 	} else if (i == '+' || i == '-') {	/* \s+, \s- */
1917c478bd9Sstevel@tonic-gate 		j = cbits(getch());
1927c478bd9Sstevel@tonic-gate 		if (ischar(j) && isdigit(j)) {		/* \s+d, \s-d */
1937c478bd9Sstevel@tonic-gate 			;
1947c478bd9Sstevel@tonic-gate 		} else if (j == '(') {		/* \s+(dd, \s-(dd */
1957c478bd9Sstevel@tonic-gate 			getch();
1967c478bd9Sstevel@tonic-gate 			getch();
1977c478bd9Sstevel@tonic-gate 		}
1987c478bd9Sstevel@tonic-gate 	}
199*e5190c10Smuffin 
200*e5190c10Smuffin 	return (0);
2017c478bd9Sstevel@tonic-gate }
2027c478bd9Sstevel@tonic-gate 
2037c478bd9Sstevel@tonic-gate 
2047c478bd9Sstevel@tonic-gate tchar setht()		/* set character height from \H'...' */
2057c478bd9Sstevel@tonic-gate {
2067c478bd9Sstevel@tonic-gate 	int	n;
2077c478bd9Sstevel@tonic-gate 	tchar c;
2087c478bd9Sstevel@tonic-gate 
2097c478bd9Sstevel@tonic-gate 	getch();
2107c478bd9Sstevel@tonic-gate 	n = inumb(&apts);
2117c478bd9Sstevel@tonic-gate 	getch();
2127c478bd9Sstevel@tonic-gate 	return(0);
2137c478bd9Sstevel@tonic-gate }
2147c478bd9Sstevel@tonic-gate 
2157c478bd9Sstevel@tonic-gate 
2167c478bd9Sstevel@tonic-gate tchar setslant()		/* set slant from \S'...' */
2177c478bd9Sstevel@tonic-gate {
2187c478bd9Sstevel@tonic-gate 	int	n;
2197c478bd9Sstevel@tonic-gate 	tchar c;
2207c478bd9Sstevel@tonic-gate 
2217c478bd9Sstevel@tonic-gate 	getch();
2227c478bd9Sstevel@tonic-gate 	n = 0;
2237c478bd9Sstevel@tonic-gate 	n = inumb(&n);
2247c478bd9Sstevel@tonic-gate 	getch();
2257c478bd9Sstevel@tonic-gate 	return(0);
2267c478bd9Sstevel@tonic-gate }
2277c478bd9Sstevel@tonic-gate 
2287c478bd9Sstevel@tonic-gate 
229*e5190c10Smuffin int
2307c478bd9Sstevel@tonic-gate caseft()
2317c478bd9Sstevel@tonic-gate {
2327c478bd9Sstevel@tonic-gate 	skip();
2337c478bd9Sstevel@tonic-gate 	setfont(1);
234*e5190c10Smuffin 
235*e5190c10Smuffin 	return (0);
2367c478bd9Sstevel@tonic-gate }
2377c478bd9Sstevel@tonic-gate 
2387c478bd9Sstevel@tonic-gate 
239*e5190c10Smuffin int
2407c478bd9Sstevel@tonic-gate setfont(a)
2417c478bd9Sstevel@tonic-gate int	a;
2427c478bd9Sstevel@tonic-gate {
243*e5190c10Smuffin 	int	i, j;
2447c478bd9Sstevel@tonic-gate 
2457c478bd9Sstevel@tonic-gate 	if (a)
2467c478bd9Sstevel@tonic-gate 		i = getrq();
2477c478bd9Sstevel@tonic-gate 	else
2487c478bd9Sstevel@tonic-gate 		i = getsn();
2497c478bd9Sstevel@tonic-gate 	if (!i || i == 'P') {
2507c478bd9Sstevel@tonic-gate 		j = font1;
2517c478bd9Sstevel@tonic-gate 		goto s0;
2527c478bd9Sstevel@tonic-gate 	}
2537c478bd9Sstevel@tonic-gate 	if (i == 'S' || i == '0')
254*e5190c10Smuffin 		return (0);
2557c478bd9Sstevel@tonic-gate 	if ((j = findft(i, fontlab)) == -1)
256*e5190c10Smuffin 		return (0);
2577c478bd9Sstevel@tonic-gate s0:
2587c478bd9Sstevel@tonic-gate 	font1 = font;
2597c478bd9Sstevel@tonic-gate 	font = j;
2607c478bd9Sstevel@tonic-gate 	mchbits();
261*e5190c10Smuffin 
262*e5190c10Smuffin 	return (0);
2637c478bd9Sstevel@tonic-gate }
2647c478bd9Sstevel@tonic-gate 
2657c478bd9Sstevel@tonic-gate 
266*e5190c10Smuffin int
2677c478bd9Sstevel@tonic-gate setwd()
2687c478bd9Sstevel@tonic-gate {
269*e5190c10Smuffin 	int	base, wid;
270*e5190c10Smuffin 	tchar i;
2717c478bd9Sstevel@tonic-gate 	int	delim, emsz, k;
2727c478bd9Sstevel@tonic-gate 	int	savhp, savapts, savapts1, savfont, savfont1, savpts, savpts1;
2737c478bd9Sstevel@tonic-gate 
2747c478bd9Sstevel@tonic-gate 	base = numtab[ST].val = numtab[ST].val = wid = numtab[CT].val = 0;
2757c478bd9Sstevel@tonic-gate 	if (ismot(i = getch()))
276*e5190c10Smuffin 		return (0);
2777c478bd9Sstevel@tonic-gate 	delim = cbits(i);
2787c478bd9Sstevel@tonic-gate 	savhp = numtab[HP].val;
2797c478bd9Sstevel@tonic-gate 	numtab[HP].val = 0;
2807c478bd9Sstevel@tonic-gate 	savapts = apts;
2817c478bd9Sstevel@tonic-gate 	savapts1 = apts1;
2827c478bd9Sstevel@tonic-gate 	savfont = font;
2837c478bd9Sstevel@tonic-gate 	savfont1 = font1;
2847c478bd9Sstevel@tonic-gate 	savpts = pts;
2857c478bd9Sstevel@tonic-gate 	savpts1 = pts1;
2867c478bd9Sstevel@tonic-gate 	setwdf++;
2877c478bd9Sstevel@tonic-gate 	while (cbits(i = getch()) != delim && !nlflg) {
2887c478bd9Sstevel@tonic-gate 		k = width(i);
2897c478bd9Sstevel@tonic-gate 		wid += k;
2907c478bd9Sstevel@tonic-gate 		numtab[HP].val += k;
2917c478bd9Sstevel@tonic-gate 		if (!ismot(i)) {
2927c478bd9Sstevel@tonic-gate 			emsz = (INCH * pts + 36) / 72;
2937c478bd9Sstevel@tonic-gate 		} else if (isvmot(i)) {
2947c478bd9Sstevel@tonic-gate 			k = absmot(i);
2957c478bd9Sstevel@tonic-gate 			if (isnmot(i))
2967c478bd9Sstevel@tonic-gate 				k = -k;
2977c478bd9Sstevel@tonic-gate 			base -= k;
2987c478bd9Sstevel@tonic-gate 			emsz = 0;
2997c478bd9Sstevel@tonic-gate 		} else
3007c478bd9Sstevel@tonic-gate 			continue;
3017c478bd9Sstevel@tonic-gate 		if (base < numtab[SB].val)
3027c478bd9Sstevel@tonic-gate 			numtab[SB].val = base;
3037c478bd9Sstevel@tonic-gate 		if ((k = base + emsz) > numtab[ST].val)
3047c478bd9Sstevel@tonic-gate 			numtab[ST].val = k;
3057c478bd9Sstevel@tonic-gate 	}
3067c478bd9Sstevel@tonic-gate 	setn1(wid, 0, (tchar) 0);
3077c478bd9Sstevel@tonic-gate 	numtab[HP].val = savhp;
3087c478bd9Sstevel@tonic-gate 	apts = savapts;
3097c478bd9Sstevel@tonic-gate 	apts1 = savapts1;
3107c478bd9Sstevel@tonic-gate 	font = savfont;
3117c478bd9Sstevel@tonic-gate 	font1 = savfont1;
3127c478bd9Sstevel@tonic-gate 	pts = savpts;
3137c478bd9Sstevel@tonic-gate 	pts1 = savpts1;
3147c478bd9Sstevel@tonic-gate 	mchbits();
3157c478bd9Sstevel@tonic-gate 	setwdf = 0;
316*e5190c10Smuffin 
317*e5190c10Smuffin 	return (0);
3187c478bd9Sstevel@tonic-gate }
3197c478bd9Sstevel@tonic-gate 
3207c478bd9Sstevel@tonic-gate 
3217c478bd9Sstevel@tonic-gate tchar vmot()
3227c478bd9Sstevel@tonic-gate {
3237c478bd9Sstevel@tonic-gate 	dfact = lss;
3247c478bd9Sstevel@tonic-gate 	vflag++;
3257c478bd9Sstevel@tonic-gate 	return(mot());
3267c478bd9Sstevel@tonic-gate }
3277c478bd9Sstevel@tonic-gate 
3287c478bd9Sstevel@tonic-gate 
3297c478bd9Sstevel@tonic-gate tchar hmot()
3307c478bd9Sstevel@tonic-gate {
3317c478bd9Sstevel@tonic-gate 	dfact = EM;
3327c478bd9Sstevel@tonic-gate 	return(mot());
3337c478bd9Sstevel@tonic-gate }
3347c478bd9Sstevel@tonic-gate 
3357c478bd9Sstevel@tonic-gate 
3367c478bd9Sstevel@tonic-gate tchar mot()
3377c478bd9Sstevel@tonic-gate {
338*e5190c10Smuffin 	int j, n;
339*e5190c10Smuffin 	tchar i;
3407c478bd9Sstevel@tonic-gate 
3417c478bd9Sstevel@tonic-gate 	j = HOR;
3427c478bd9Sstevel@tonic-gate 	getch(); /*eat delim*/
3437c478bd9Sstevel@tonic-gate 	if (n = atoi()) {
3447c478bd9Sstevel@tonic-gate 		if (vflag)
3457c478bd9Sstevel@tonic-gate 			j = VERT;
3467c478bd9Sstevel@tonic-gate 		i = makem(quant(n, j));
3477c478bd9Sstevel@tonic-gate 	} else
3487c478bd9Sstevel@tonic-gate 		i = 0;
3497c478bd9Sstevel@tonic-gate 	getch();
3507c478bd9Sstevel@tonic-gate 	vflag = 0;
3517c478bd9Sstevel@tonic-gate 	dfact = 1;
3527c478bd9Sstevel@tonic-gate 	return(i);
3537c478bd9Sstevel@tonic-gate }
3547c478bd9Sstevel@tonic-gate 
3557c478bd9Sstevel@tonic-gate 
3567c478bd9Sstevel@tonic-gate tchar sethl(k)
3577c478bd9Sstevel@tonic-gate int	k;
3587c478bd9Sstevel@tonic-gate {
359*e5190c10Smuffin 	int	j;
3607c478bd9Sstevel@tonic-gate 	tchar i;
3617c478bd9Sstevel@tonic-gate 
3627c478bd9Sstevel@tonic-gate 	j = t.Halfline;
3637c478bd9Sstevel@tonic-gate 	if (k == 'u')
3647c478bd9Sstevel@tonic-gate 		j = -j;
3657c478bd9Sstevel@tonic-gate 	else if (k == 'r')
3667c478bd9Sstevel@tonic-gate 		j = -2 * j;
3677c478bd9Sstevel@tonic-gate 	vflag++;
3687c478bd9Sstevel@tonic-gate 	i = makem(j);
3697c478bd9Sstevel@tonic-gate 	vflag = 0;
3707c478bd9Sstevel@tonic-gate 	return(i);
3717c478bd9Sstevel@tonic-gate }
3727c478bd9Sstevel@tonic-gate 
3737c478bd9Sstevel@tonic-gate 
3747c478bd9Sstevel@tonic-gate tchar makem(i)
3757c478bd9Sstevel@tonic-gate int	i;
3767c478bd9Sstevel@tonic-gate {
377*e5190c10Smuffin 	tchar j;
3787c478bd9Sstevel@tonic-gate 
3797c478bd9Sstevel@tonic-gate 	if ((j = i) < 0)
3807c478bd9Sstevel@tonic-gate 		j = -j;
3817c478bd9Sstevel@tonic-gate 	j |= MOT;
3827c478bd9Sstevel@tonic-gate 	if (i < 0)
3837c478bd9Sstevel@tonic-gate 		j |= NMOT;
3847c478bd9Sstevel@tonic-gate 	if (vflag)
3857c478bd9Sstevel@tonic-gate 		j |= VMOT;
3867c478bd9Sstevel@tonic-gate 	return(j);
3877c478bd9Sstevel@tonic-gate }
3887c478bd9Sstevel@tonic-gate 
3897c478bd9Sstevel@tonic-gate 
3907c478bd9Sstevel@tonic-gate tchar getlg(i)
3917c478bd9Sstevel@tonic-gate tchar	i;
3927c478bd9Sstevel@tonic-gate {
3937c478bd9Sstevel@tonic-gate 	return(i);
3947c478bd9Sstevel@tonic-gate }
3957c478bd9Sstevel@tonic-gate 
3967c478bd9Sstevel@tonic-gate 
397*e5190c10Smuffin int
3987c478bd9Sstevel@tonic-gate caselg()
3997c478bd9Sstevel@tonic-gate {
400*e5190c10Smuffin 	return (0);
4017c478bd9Sstevel@tonic-gate }
4027c478bd9Sstevel@tonic-gate 
4037c478bd9Sstevel@tonic-gate 
404*e5190c10Smuffin int
4057c478bd9Sstevel@tonic-gate casefp()
4067c478bd9Sstevel@tonic-gate {
407*e5190c10Smuffin 	int	i, j;
4087c478bd9Sstevel@tonic-gate 
4097c478bd9Sstevel@tonic-gate 	skip();
4107c478bd9Sstevel@tonic-gate 	if ((i = cbits(getch()) - '0') < 0 || i > nfonts)
411*e5190c10Smuffin 		return (0);
4127c478bd9Sstevel@tonic-gate 	if (skip() || !(j = getrq()))
413*e5190c10Smuffin 		return (0);
4147c478bd9Sstevel@tonic-gate 	fontlab[i] = j;
415*e5190c10Smuffin 
416*e5190c10Smuffin 	return (0);
4177c478bd9Sstevel@tonic-gate }
4187c478bd9Sstevel@tonic-gate 
4197c478bd9Sstevel@tonic-gate 
420*e5190c10Smuffin int
4217c478bd9Sstevel@tonic-gate casecs()
4227c478bd9Sstevel@tonic-gate {
423*e5190c10Smuffin 	return (0);
4247c478bd9Sstevel@tonic-gate }
4257c478bd9Sstevel@tonic-gate 
4267c478bd9Sstevel@tonic-gate 
427*e5190c10Smuffin int
4287c478bd9Sstevel@tonic-gate casebd()
4297c478bd9Sstevel@tonic-gate {
430*e5190c10Smuffin 	int	i, j, k;
4317c478bd9Sstevel@tonic-gate 
4327c478bd9Sstevel@tonic-gate 	k = 0;
4337c478bd9Sstevel@tonic-gate bd0:
4347c478bd9Sstevel@tonic-gate 	if (skip() || !(i = getrq()) || (j = findft(i)) == -1) {
4357c478bd9Sstevel@tonic-gate 		if (k)
4367c478bd9Sstevel@tonic-gate 			goto bd1;
4377c478bd9Sstevel@tonic-gate 		else
438*e5190c10Smuffin 			return (0);
4397c478bd9Sstevel@tonic-gate 	}
4407c478bd9Sstevel@tonic-gate 	if (j == smnt) {
4417c478bd9Sstevel@tonic-gate 		k = smnt;
4427c478bd9Sstevel@tonic-gate 		goto bd0;
4437c478bd9Sstevel@tonic-gate 	}
4447c478bd9Sstevel@tonic-gate 	if (k) {
4457c478bd9Sstevel@tonic-gate 		sbold = j;
4467c478bd9Sstevel@tonic-gate 		j = k;
4477c478bd9Sstevel@tonic-gate 	}
4487c478bd9Sstevel@tonic-gate bd1:
4497c478bd9Sstevel@tonic-gate 	skip();
4507c478bd9Sstevel@tonic-gate 	noscale++;
4517c478bd9Sstevel@tonic-gate 	bdtab[j] = atoi();
4527c478bd9Sstevel@tonic-gate 	noscale = 0;
453*e5190c10Smuffin 
454*e5190c10Smuffin 	return (0);
4557c478bd9Sstevel@tonic-gate }
4567c478bd9Sstevel@tonic-gate 
4577c478bd9Sstevel@tonic-gate 
458*e5190c10Smuffin int
4597c478bd9Sstevel@tonic-gate casevs()
4607c478bd9Sstevel@tonic-gate {
461*e5190c10Smuffin 	int	i;
4627c478bd9Sstevel@tonic-gate 
4637c478bd9Sstevel@tonic-gate 	skip();
4647c478bd9Sstevel@tonic-gate 	vflag++;
4657c478bd9Sstevel@tonic-gate 	dfact = INCH; /*default scaling is points!*/
4667c478bd9Sstevel@tonic-gate 	dfactd = 72;
4677c478bd9Sstevel@tonic-gate 	res = VERT;
4687c478bd9Sstevel@tonic-gate 	i = inumb(&lss);
4697c478bd9Sstevel@tonic-gate 	if (nonumb)
4707c478bd9Sstevel@tonic-gate 		i = lss1;
4717c478bd9Sstevel@tonic-gate 	if (i < VERT)
4727c478bd9Sstevel@tonic-gate 		i = VERT;	/* was VERT */
4737c478bd9Sstevel@tonic-gate 	lss1 = lss;
4747c478bd9Sstevel@tonic-gate 	lss = i;
475*e5190c10Smuffin 
476*e5190c10Smuffin 	return (0);
4777c478bd9Sstevel@tonic-gate }
4787c478bd9Sstevel@tonic-gate 
4797c478bd9Sstevel@tonic-gate 
4807c478bd9Sstevel@tonic-gate 
481*e5190c10Smuffin int
4827c478bd9Sstevel@tonic-gate casess()
4837c478bd9Sstevel@tonic-gate {
484*e5190c10Smuffin 	return (0);
4857c478bd9Sstevel@tonic-gate }
4867c478bd9Sstevel@tonic-gate 
4877c478bd9Sstevel@tonic-gate 
4887c478bd9Sstevel@tonic-gate tchar xlss()
4897c478bd9Sstevel@tonic-gate {
4907c478bd9Sstevel@tonic-gate 	/* stores \x'...' into
4917c478bd9Sstevel@tonic-gate 	 * two successive tchars.
4927c478bd9Sstevel@tonic-gate 	 * the first contains HX, the second the value,
4937c478bd9Sstevel@tonic-gate 	 * encoded as a vertical motion.
4947c478bd9Sstevel@tonic-gate 	 * decoding is done in n2.c by pchar().
4957c478bd9Sstevel@tonic-gate 	 */
4967c478bd9Sstevel@tonic-gate 	int	i;
4977c478bd9Sstevel@tonic-gate 
4987c478bd9Sstevel@tonic-gate 	getch();
4997c478bd9Sstevel@tonic-gate 	dfact = lss;
5007c478bd9Sstevel@tonic-gate 	i = quant(atoi(), VERT);
5017c478bd9Sstevel@tonic-gate 	dfact = 1;
5027c478bd9Sstevel@tonic-gate 	getch();
5037c478bd9Sstevel@tonic-gate 	if (i >= 0)
5047c478bd9Sstevel@tonic-gate 		*pbp++ = MOT | VMOT | i;
5057c478bd9Sstevel@tonic-gate 	else
5067c478bd9Sstevel@tonic-gate 		*pbp++ = MOT | VMOT | NMOT | -i;
5077c478bd9Sstevel@tonic-gate 	return(HX);
5087c478bd9Sstevel@tonic-gate }
509