n9.c revision e5190c108bde19ca4d7c03b1d1eab7b00bd3a1ed
/*
* 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 1989 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.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <libintl.h>
#include <stdlib.h>
#include "tdef.h"
#ifdef NROFF
#include "tw.h"
#endif
#include "ext.h"
#ifdef EUC
#include <locale.h>
#include <wctype.h>
#include <langinfo.h>
#define ISO646 "646"
int multi_locale;
int csi_width[4] = {
1,
1,
2,
3,
};
#endif /* EUC */
/*
* troff9.c
*
* misc functions
*/
{
tchar i;
i |= ZBIT;
return(i);
}
int
setline()
{
tchar *i;
tchar c;
int length;
return (0);
vflag = 0;
dfact = 1;
if (!length) {
return (0);
}
s0:
ch = c;
goto s0;
w = width(c);
i = linebuf;
if (length < 0) {
}
*i++ = c;
goto s1;
}
*i++ = c | ZBIT;
}
if (cnt) {
*i++ = RPT;
*i++ = cnt;
*i++ = c;
}
s1:
*i++ = 0;
return (0);
}
int
eat(c)
int c;
{
int i;
;
return(i);
}
int
setov()
{
int j, k;
return (0);
o[k] = i;
w[k] = width(i);
}
o[k] = w[k] = 0;
if (o[0])
for (j = 1; j; ) {
j = 0;
for (k = 1; o[k] ; k++) {
if (w[k-1] < w[k]) {
j++;
i = w[k];
w[k] = w[k-1];
w[k-1] = i;
i = o[k];
o[k] = o[k-1];
o[k-1] = i;
}
}
}
else
return (0);
for (k = 0; o[k]; k++)
;
while (k>0) {
k--;
*pbp++ = o[k];
}
return (0);
}
int
setbra()
{
int k;
return (0);
j = brabuf + 1;
cnt = 0;
#ifdef NROFF
#endif
#ifndef NROFF
#endif
*j++ = i | ZBIT;
*j++ = dwn;
cnt++;
}
if (--cnt < 0)
return (0);
else if (!cnt) {
ch = *(j - 2);
return (0);
}
*j = 0;
#ifdef NROFF
#endif
#ifndef NROFF
#endif
*--j &= ~ZBIT;
return (0);
}
int
setvline()
{
int i;
return (0);
vflag++;
dfact = 1;
if (!i) {
vflag = 0;
return (0);
}
} else
getch();
c |= ZBIT;
neg = 0;
if (i < 0) {
i = -i;
}
#ifdef NROFF
v = 2 * t.Halfline;
#endif
#ifndef NROFF
v = EM;
#endif
cnt = i / v;
if (!neg)
*vlp++ = c;
}
*vlp++ = c;
}
if (!neg)
vlp--;
*vlp++ = 0;
vflag = 0;
return (0);
}
int
setdraw() /* generate internal cookies for a drawing function */
{
/* input is \D'f dx dy dx dy ... c' (or at least it had better be) */
/* this does drawing function f with character c and the */
/* specified dx,dy pairs interpreted as appropriate */
/* pairs are deltas from last point, except for radii */
/* l dx dy: line from here by dx,dy */
/* c x: circle of diameter x, left side here */
/* e x y: ellipse of diameters x,y, left side here */
/* a dx1 dy1 dx2 dy2:
ccw arc: ctr at dx1,dy1, then end at dx2,dy2 from there */
/* ~ dx1 dy1 dx2 dy2...:
spline to dx1,dy1 to dx2,dy2 ... */
/* f dx dy ...: f is any other char: like spline */
return (0);
for (i = 0; i < NPAIR ; i++) {
c = getch();
break;
/* ought to pick up optional drawing character */
if (cbits(c) != ' ')
ch = c;
vflag = 0;
dy[i++] = 0;
break;
}
vflag = 1;
}
dfact = 1;
vflag = 0;
#ifndef NROFF
for (k = 0, j = 3; k < i; k++) {
}
if (type == DRAWELLIPSE) {
j = 6;
}
drawbuf[j] = 0;
#endif
return (0);
}
int
casefc()
{
int i;
tchar j;
padc = ' ';
return (0);
fc = i;
return (0);
return (0);
}
setfield(x)
int x;
{
int i, j;
int savepos;
if (x == tabch)
else if (x == ldrch)
for (j = 0; ; j++) {
if (x == savfc)
jj = 0;
goto rtn;
}
break;
}
if (x == savfc) {
while (1) {
if (j == padc) {
npad++;
break;
goto s1;
} else if (j == savfc)
break;
else if (j == '\n') {
temp = j;
nlflg = 0;
break;
}
s1:
break;
}
if (!npad) {
npad++;
*fp++ = 0;
}
*fp++ = 0;
if ((j -= i * npad) < 0)
j = -j;
if (temp < 0)
if (j) {
j -= HOR;
}
}
jj = 0;
} else if (type == 0) {
/*plain tab or leader*/
widthp = j;
}
length %= j;
}
if (length)
else
} else {
/*center tab*/
/*right tab*/
break;
}
*fp++ = 0;
else
length %= j;
}
nlflg = 0;
}
rtn:
return(jj);
}
#ifdef EUC
#ifdef NROFF
/* locale specific initialization */
int localize()
{
extern int wdbindf();
char *codeset;
if (MB_CUR_MAX > 1)
multi_locale = 1;
else {
if (*codeset == '\0' ||
/*
* if codeset is an empty string
* assumes this is C locale (7-bit) locale.
* This happens in 2.5, 2.5.1, and 2.6 system
* Or, if codeset is "646"
* this is 7-bit locale.
*/
multi_locale = 0;
} else {
/* 8-bit locale */
multi_locale = 1;
}
}
return (0);
}
#endif /* EUC */
#endif /* NROFF */