n6.c revision 2bc987325e3ded1865bff043128661815c4690b9
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2003 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* University Copyright- Copyright (c) 1982, 1986, 1988
* The Regents of the University of California
* All Rights Reserved
*
* University Acknowledgment- Portions of this document are derived from
* software developed by the University of California, Berkeley, and its
* contributors.
*/
#include "tdef.h"
#include "tw.h"
#include "ext.h"
#include <ctype.h>
/*
* n6.c -- width functions, sizes and fonts
*/
int sbold = 0;
extern int nchtab;
int
width(j)
tchar j;
{
int i, k;
if (iszbit(j))
return(0);
if (isvmot(j))
return(0);
k = absmot(j);
if (isnmot(j))
k = -k;
return(k);
}
i = cbits(j);
if (i < ' ') {
if (i == '\b')
return(-widthp);
if (i == PRESC)
i = eschar;
else if (iscontrol(i))
return(0);
}
if (i==ohc)
return(0);
#ifdef EUC
#ifdef NROFF
if (multi_locale) {
switch(j & MBMASK) {
case BYTE_CHR:
case LASTOFMB:
break;
default:
k = 0;
break;
}
widthp = k;
return(k);
}
}
i &= 0x1ff;
#endif /* NROFF */
#endif /* EUC */
i = trtab[i];
if (i < 32)
return(0);
widthp = k;
return(k);
}
{
int j;
char temp[10];
char *s;
s = temp;
return(0);
*s = '\0';
return j | chbits;
else
return 0;
}
{ /* for now, a no-op */
int i, n, nf;
getch();
n = 0;
n = inumb(&n);
getch();
if (nonumb)
return 0;
return n + nchtab + _SPECCHAR_ST;
}
int
findft(i)
int i;
{
int k;
return(k);
for (k = 0; fontlab[k] != i; k++)
if (k > nfonts)
return(-1);
return(k);
}
int
caseps()
{
return (0);
}
int
mchbits()
{
chbits = 0;
return (0);
}
int
setps()
{
int i, j;
i -= '0';
if (i == 0) /* \s0 */
;
isdigit(j)) { /* \sdd */
ch = 0;
}
} else if (i == '(') { /* \s(dd */
getch();
getch();
} else if (i == '+' || i == '-') { /* \s+, \s- */
;
} else if (j == '(') { /* \s+(dd, \s-(dd */
getch();
getch();
}
}
return (0);
}
{
int n;
tchar c;
getch();
getch();
return(0);
}
{
int n;
tchar c;
getch();
n = 0;
n = inumb(&n);
getch();
return(0);
}
int
caseft()
{
skip();
setfont(1);
return (0);
}
int
setfont(a)
int a;
{
int i, j;
if (a)
i = getrq();
else
i = getsn();
if (!i || i == 'P') {
j = font1;
goto s0;
}
if (i == 'S' || i == '0')
return (0);
return (0);
s0:
font = j;
mchbits();
return (0);
}
int
setwd()
{
tchar i;
return (0);
setwdf++;
k = width(i);
wid += k;
if (!ismot(i)) {
} else if (isvmot(i)) {
k = absmot(i);
if (isnmot(i))
k = -k;
base -= k;
emsz = 0;
} else
continue;
}
mchbits();
setwdf = 0;
return (0);
}
{
vflag++;
return(mot());
}
{
return(mot());
}
{
int j, n;
tchar i;
j = HOR;
getch(); /*eat delim*/
if (n = atoi()) {
if (vflag)
j = VERT;
} else
i = 0;
getch();
vflag = 0;
dfact = 1;
return(i);
}
int k;
{
int j;
tchar i;
j = t.Halfline;
if (k == 'u')
j = -j;
else if (k == 'r')
j = -2 * j;
vflag++;
i = makem(j);
vflag = 0;
return(i);
}
int i;
{
tchar j;
if ((j = i) < 0)
j = -j;
j |= MOT;
if (i < 0)
j |= NMOT;
if (vflag)
j |= VMOT;
return(j);
}
tchar i;
{
return(i);
}
int
caselg()
{
return (0);
}
int
casefp()
{
int i, j;
skip();
return (0);
return (0);
fontlab[i] = j;
return (0);
}
int
casecs()
{
return (0);
}
int
casebd()
{
int i, j, k;
k = 0;
bd0:
if (k)
goto bd1;
else
return (0);
}
if (j == smnt) {
k = smnt;
goto bd0;
}
if (k) {
sbold = j;
j = k;
}
bd1:
skip();
noscale++;
noscale = 0;
return (0);
}
int
casevs()
{
int i;
skip();
vflag++;
dfactd = 72;
if (nonumb)
i = lss1;
if (i < VERT)
i = VERT; /* was VERT */
lss = i;
return (0);
}
int
casess()
{
return (0);
}
{
/* stores \x'...' into
* two successive tchars.
* the first contains HX, the second the value,
* encoded as a vertical motion.
* decoding is done in n2.c by pchar().
*/
int i;
getch();
dfact = 1;
getch();
if (i >= 0)
else
return(HX);
}