summaryrefslogtreecommitdiffstats
path: root/contrib/groff/src/preproc/grn
diff options
context:
space:
mode:
authorru <ru@FreeBSD.org>2005-10-20 10:45:19 +0000
committerru <ru@FreeBSD.org>2005-10-20 10:45:19 +0000
commit353ac0b339df3493d1950b6527988b77b76bd197 (patch)
tree8a188846a3f5bd2f2b8cb869cba64e3c470a2b26 /contrib/groff/src/preproc/grn
parentc40093b1f1b43dc237b9d272697cdd0842ec64ec (diff)
downloadFreeBSD-src-353ac0b339df3493d1950b6527988b77b76bd197.zip
FreeBSD-src-353ac0b339df3493d1950b6527988b77b76bd197.tar.gz
Virgin import of FSF groff v1.19.2
Diffstat (limited to 'contrib/groff/src/preproc/grn')
-rw-r--r--contrib/groff/src/preproc/grn/gprint.h2
-rw-r--r--contrib/groff/src/preproc/grn/grn.man38
-rw-r--r--contrib/groff/src/preproc/grn/hdb.cpp33
-rw-r--r--contrib/groff/src/preproc/grn/hgraph.cpp144
-rw-r--r--contrib/groff/src/preproc/grn/hpoint.cpp26
-rw-r--r--contrib/groff/src/preproc/grn/main.cpp42
6 files changed, 149 insertions, 136 deletions
diff --git a/contrib/groff/src/preproc/grn/gprint.h b/contrib/groff/src/preproc/grn/gprint.h
index b9df60e..ad3be44 100644
--- a/contrib/groff/src/preproc/grn/gprint.h
+++ b/contrib/groff/src/preproc/grn/gprint.h
@@ -66,7 +66,7 @@
#define MOD 3
typedef struct point {
- float x, y;
+ double x, y;
struct point *nextpt;
} POINT;
diff --git a/contrib/groff/src/preproc/grn/grn.man b/contrib/groff/src/preproc/grn/grn.man
index 9722145..575b4ee 100644
--- a/contrib/groff/src/preproc/grn/grn.man
+++ b/contrib/groff/src/preproc/grn/grn.man
@@ -1,6 +1,6 @@
'\" t
.ig
-Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
+Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
@@ -17,17 +17,24 @@ versions, except that this permission notice may be included in
translations approved by the Free Software Foundation instead of in
the original English.
..
+.
+.do nr grn_C \n[.C]
+.cp 0
+.
.de TQ
-.br
-.ns
-.TP \\$1
+. br
+. ns
+. TP \\$1
..
+.
.\" Like TP, but if specified indent is more than half
.\" the current line-length - indent, use the default indent.
.de Tp
-.ie \\n(.$=0:((0\\$1)*2u>(\\n(.lu-\\n(.iu)) .TP
-.el .TP "\\$1"
+. ie \\n(.$=0:((0\\$1)*2u>(\\n(.lu-\\n(.iu)) .TP
+. el .TP "\\$1"
..
+.
+.
.TH @G@GRN @MAN1EXT@ "@MDATE@" "Groff Version @VERSION@"
.SH NAME
@g@grn \- groff preprocessor for gremlin files
@@ -142,7 +149,7 @@ Recognize
.B .GS
and
.B .GE
-(resp.
+(and
.BR .GF )
even when followed by a character other than space or newline.
.\".TP
@@ -188,7 +195,7 @@ Set
text size number 1 (2, 3, or 4) to
.I N
points.
-The default is 12 (resp. 16, 24, and 36).
+The default is 12 (16, 24, and 36, respectively).
.TP
.BI roman\ f
.TQ
@@ -202,7 +209,7 @@ Set the roman (italics, bold, or special) font to
font
.I f
(either a name or number).
-The default is R (resp. I, B, and S).
+The default is R (I, B, and S, respectively).
.TP
.BI l\ f
.TQ
@@ -242,11 +249,11 @@ may be abbreviated down to `sc'.
.BI thick\ N
Set the thickness of
.IR gremlin 's
-narrow (resp. medium and thick) lines to
+narrow (medium and thick, respectively) lines to
.I N
times 0.15pt (this value can be changed at compile time).
-The default is 1.0 (resp. 3.0 and 5.0), which corresponds to 0.15pt
-(resp. 0.45pt and 0.75pt).
+The default is 1.0 (3.0 and 5.0, respectively), which corresponds to 0.15pt
+(0.45pt and 0.75pt, respectively).
A thickness value of zero selects the smallest available line thickness.
Negative values cause the line thickness to be proportional to the current
point size.
@@ -255,7 +262,10 @@ point size.
Scale text to match the picture.
Gremlin text is usually printed in the point size specified with the
commands
-.BR 1 ,\ 2 ,\ 3 ,\ or\ 4
+.BR 1 ,
+.BR 2 ,
+.BR 3 ,
+.RB or\~ 4 ,
regardless of any scaling factors in the picture.
Setting
.B pointscale
@@ -635,6 +645,8 @@ David Slattengren and Barry Roitblat wrote the original Berkeley
Daniel Senderowicz and Werner Lemberg modified it for
.IR groff .
.
+.cp \n[grn_C]
+.
.\" Local Variables:
.\" mode: nroff
.\" End:
diff --git a/contrib/groff/src/preproc/grn/hdb.cpp b/contrib/groff/src/preproc/grn/hdb.cpp
index c9fbb7d..5f54040 100644
--- a/contrib/groff/src/preproc/grn/hdb.cpp
+++ b/contrib/groff/src/preproc/grn/hdb.cpp
@@ -1,4 +1,4 @@
-/* Last non-groff version: hdb.c 1.8 (Berkeley) 84/10/20
+ /* Last non-groff version: hdb.c 1.8 (Berkeley) 84/10/20
*
* Copyright -C- 1982 Barry S. Roitblat
*
@@ -22,12 +22,13 @@
extern int linenum; /* current line number in input file */
extern char gremlinfile[]; /* name of file currently reading */
extern int SUNFILE; /* TRUE if SUN gremlin file */
-extern void savebounds(float x, float y);
+extern int compatibility_flag; /* TRUE if in compatibility mode */
+extern void savebounds(double x, double y);
/* imports from hpoint.cpp */
extern POINT *PTInit();
-extern POINT *PTMakePoint(float x, float y, POINT ** pplist);
+extern POINT *PTMakePoint(double x, double y, POINT ** pplist);
int DBGetType(register char *s);
@@ -79,12 +80,12 @@ DBRead(register FILE *file)
{
register int i;
register int done; /* flag for input exhausted */
- register float nx; /* x holder so x is not set before orienting */
+ register double nx; /* x holder so x is not set before orienting */
int type; /* element type */
ELT *elist; /* pointer to the file's elements */
POINT *plist; /* pointer for reading in points */
char string[MAXSTRING], *txt;
- float x, y; /* x and y are read in point coords */
+ double x, y; /* x and y are read in point coords */
int len, brush, size;
int lastpoint;
@@ -99,7 +100,7 @@ DBRead(register FILE *file)
SUNFILE = TRUE;
}
- (void) fscanf(file, "%d%f%f\n", &size, &x, &y);
+ (void) fscanf(file, "%d%lf%lf\n", &size, &x, &y);
/* ignore orientation and file positioning point */
done = FALSE;
@@ -115,12 +116,11 @@ DBRead(register FILE *file)
type = DBGetType(string); /* interpret element type */
if (type < 0) { /* no more data */
done = TRUE;
- (void) fclose(file);
} else {
#ifdef UW_FASTSCAN
(void) xscanf(file, &x, &y); /* always one point */
#else
- (void) fscanf(file, "%f%f\n", &x, &y); /* always one point */
+ (void) fscanf(file, "%lf%lf\n", &x, &y); /* always one point */
#endif /* UW_FASTSCAN */
plist = PTInit(); /* NULL point list */
@@ -144,9 +144,13 @@ DBRead(register FILE *file)
if (string[0] == '*') { /* SUN gremlin file */
lastpoint = TRUE;
} else {
- (void) sscanf(string, "%f%f", &x, &y);
+ (void) sscanf(string, "%lf%lf", &x, &y);
if ((x == -1.00 && y == -1.00) && (!SUNFILE))
lastpoint = TRUE;
+ else {
+ if (compatibility_flag)
+ savebounds(xorn(x, y), yorn(x, y));
+ }
}
} while (!lastpoint);
#endif /* UW_FASTSCAN */
@@ -170,7 +174,7 @@ DBRead(register FILE *file)
if (string[0] == '*') { /* SUN gremlin file */
lastpoint = TRUE;
} else {
- (void) sscanf(string, "%f%f", &x, &y);
+ (void) sscanf(string, "%lf%lf", &x, &y);
if ((x == -1.00 && y == -1.00) && (!SUNFILE))
lastpoint = TRUE;
}
@@ -182,7 +186,10 @@ DBRead(register FILE *file)
(void) getc(file); /* eat blank */
txt = (char *) malloc((unsigned) len + 1);
for (i = 0; i < len; ++i) { /* read text */
- txt[i] = getc(file);
+ int c = getc(file);
+ if (c == EOF)
+ break;
+ txt[i] = c;
}
txt[len] = '\0';
(void) DBCreateElt(type, plist, brush, size, txt, &elist);
@@ -281,8 +288,8 @@ DBGetType(register char *s)
*/
int
xscanf(FILE *f,
- float *xp,
- float *yp)
+ double *xp,
+ double *yp)
{
register int c, i, j, m, frac;
int iscale = 1, jscale = 1; /* x = i/scale, y=j/jscale */
diff --git a/contrib/groff/src/preproc/grn/hgraph.cpp b/contrib/groff/src/preproc/grn/hgraph.cpp
index d124c6c..0120895 100644
--- a/contrib/groff/src/preproc/grn/hgraph.cpp
+++ b/contrib/groff/src/preproc/grn/hgraph.cpp
@@ -8,19 +8,13 @@
#include "gprint.h"
-#ifdef NEED_DECLARATION_HYPOT
-extern "C" {
- double hypot(double, double);
-}
-#endif /* NEED_DECLARATION_HYPOT */
-
#define MAXVECT 40
#define MAXPOINTS 200
#define LINELENGTH 1
#define PointsPerInterval 64
#define pi 3.14159265358979324
#define twopi (2.0 * pi)
-#define len(a, b) hypot((double)(b.x-a.x), (double)(b.y-a.y))
+#define len(a, b) groff_hypot((double)(b.x-a.x), (double)(b.y-a.y))
extern int dotshifter; /* for the length of dotted curves */
@@ -43,7 +37,7 @@ extern int ytop;
extern int ybottom;
extern int xleft;
extern int xright;
-extern enum {
+extern enum E {
OUTLINE, FILL, BOTH
} polyfill;
@@ -62,17 +56,17 @@ void tmove(POINT * ptr);
void cr();
void drawwig(POINT * ptr, int type);
void HGtline(int x1, int y1);
-void dx(double x);
-void dy(double y);
+void deltax(double x);
+void deltay(double y);
void HGArc(register int cx, register int cy, int px, int py, int angle);
void picurve(register int *x, register int *y, int npts);
void HGCurve(int *x, int *y, int numpoints);
-void Paramaterize(int x[], int y[], float h[], int n);
-void PeriodicSpline(float h[], int z[],
- float dz[], float d2z[], float d3z[],
+void Paramaterize(int x[], int y[], double h[], int n);
+void PeriodicSpline(double h[], int z[],
+ double dz[], double d2z[], double d3z[],
int npoints);
-void NaturalEndSpline(float h[], int z[],
- float dz[], float d2z[], float d3z[],
+void NaturalEndSpline(double h[], int z[],
+ double dz[], double d2z[], double d3z[],
int npoints);
@@ -166,8 +160,8 @@ HGPrintElt(ELT *element,
* stipple fonts).
* If polyfill=BOTH, just use the \D'p ...' command.
*/
- float firstx = p1->x;
- float firsty = p1->y;
+ double firstx = p1->x;
+ double firsty = p1->y;
length = 0; /* keep track of line length so */
/* single lines don't get long */
@@ -223,8 +217,8 @@ HGPrintElt(ELT *element,
while (!Nullpoint((PTNextPoint(p1)))) {
p1 = PTNextPoint(p1);
- dx((double) p1->x);
- dy((double) p1->y);
+ deltax((double) p1->x);
+ deltay((double) p1->y);
if (length++ > LINELENGTH) {
length = 0;
printf("\\\n");
@@ -233,8 +227,8 @@ HGPrintElt(ELT *element,
/* close polygon if not done so by user */
if ((firstx != p1->x) || (firsty != p1->y)) {
- dx((double) firstx);
- dy((double) firsty);
+ deltax((double) firstx);
+ deltay((double) firsty);
}
putchar('\'');
cr();
@@ -412,7 +406,7 @@ HGSetBrush(int mode)
/*----------------------------------------------------------------------------*
- | Routine: dx (x_destination)
+ | Routine: deltax (x_destination)
|
| Results: Scales and outputs a number for delta x (with a leading
| space) given `lastx' and x_destination.
@@ -421,7 +415,7 @@ HGSetBrush(int mode)
*----------------------------------------------------------------------------*/
void
-dx(double x)
+deltax(double x)
{
register int ix = (int) (x * troffscale);
@@ -431,7 +425,7 @@ dx(double x)
/*----------------------------------------------------------------------------*
- | Routine: dy (y_destination)
+ | Routine: deltay (y_destination)
|
| Results: Scales and outputs a number for delta y (with a leading
| space) given `lastyline' and y_destination.
@@ -441,7 +435,7 @@ dx(double x)
*----------------------------------------------------------------------------*/
void
-dy(double y)
+deltay(double y)
{
register int iy = (int) (y * troffscale);
@@ -600,7 +594,7 @@ HGArc(register int cx,
length = 0;
- resolution = (1.0 + hypot(xs, ys) / res) * PointsPerInterval;
+ resolution = (1.0 + groff_hypot(xs, ys) / res) * PointsPerInterval;
/* mask = (1 << (int) log10(resolution + 1.0)) - 1; */
(void) frexp(resolution, &m); /* A bit more elegant than log10 */
for (mask = 1; mask < m; mask = mask << 1);
@@ -671,13 +665,13 @@ picurve(register int *x,
for (; npts--; x++, y++) { /* traverse the line segments */
xp = x[0] - x[1];
yp = y[0] - y[1];
- nseg = (int) hypot((double) xp, (double) yp);
+ nseg = (int) groff_hypot((double) xp, (double) yp);
xp = x[1] - x[2];
yp = y[1] - y[2];
/* `nseg' is the number of line */
/* segments that will be drawn for */
/* each curve segment. */
- nseg = (int) ((double) (nseg + (int) hypot((double) xp, (double) yp)) /
+ nseg = (int) ((double) (nseg + (int) groff_hypot((double) xp, (double) yp)) /
res * PointsPerInterval);
for (i = 1; i < nseg; i++) {
@@ -713,9 +707,9 @@ HGCurve(int *x,
int *y,
int numpoints)
{
- float h[MAXPOINTS], dx[MAXPOINTS], dy[MAXPOINTS];
- float d2x[MAXPOINTS], d2y[MAXPOINTS], d3x[MAXPOINTS], d3y[MAXPOINTS];
- float t, t2, t3;
+ double h[MAXPOINTS], dx[MAXPOINTS], dy[MAXPOINTS];
+ double d2x[MAXPOINTS], d2y[MAXPOINTS], d3x[MAXPOINTS], d3y[MAXPOINTS];
+ double t, t2, t3;
register int j;
register int k;
register int nx;
@@ -751,7 +745,7 @@ HGCurve(int *x,
if ((x[j] == x[j + 1]) && (y[j] == y[j + 1]))
continue;
for (k = 0; k <= PointsPerInterval; ++k) {
- t = (float) k *h[j] / (float) PointsPerInterval;
+ t = (double) k *h[j] / (double) PointsPerInterval;
t2 = t * t;
t3 = t * t * t;
nx = x[j] + (int) (t * dx[j] + t2 * d2x[j] / 2 + t3 * d3x[j] / 6);
@@ -779,14 +773,14 @@ HGCurve(int *x,
void
Paramaterize(int x[],
int y[],
- float h[],
+ double h[],
int n)
{
register int dx;
register int dy;
register int i;
register int j;
- float u[MAXPOINTS];
+ double u[MAXPOINTS];
for (i = 1; i <= n; ++i) {
u[i] = 0;
@@ -795,7 +789,7 @@ Paramaterize(int x[],
dy = y[j + 1] - y[j];
/* Here was overflowing, so I changed it. */
/* u[i] += sqrt ((double) (dx * dx + dy * dy)); */
- u[i] += hypot((double) dx, (double) dy);
+ u[i] += groff_hypot((double) dx, (double) dy);
}
}
for (i = 1; i < n; ++i)
@@ -814,16 +808,16 @@ Paramaterize(int x[],
*----------------------------------------------------------------------------*/
void
-PeriodicSpline(float h[], /* paramaterization */
+PeriodicSpline(double h[], /* paramaterization */
int z[], /* point list */
- float dz[], /* to return the 1st derivative */
- float d2z[], /* 2nd derivative */
- float d3z[], /* 3rd derivative */
+ double dz[], /* to return the 1st derivative */
+ double d2z[], /* 2nd derivative */
+ double d3z[], /* 3rd derivative */
int npoints) /* number of valid points */
{
- float d[MAXPOINTS];
- float deltaz[MAXPOINTS], a[MAXPOINTS], b[MAXPOINTS];
- float c[MAXPOINTS], r[MAXPOINTS], s[MAXPOINTS];
+ double d[MAXPOINTS];
+ double deltaz[MAXPOINTS], a[MAXPOINTS], b[MAXPOINTS];
+ double c[MAXPOINTS], r[MAXPOINTS], s[MAXPOINTS];
int i;
/* step 1 */
@@ -886,15 +880,15 @@ PeriodicSpline(float h[], /* paramaterization */
*----------------------------------------------------------------------------*/
void
-NaturalEndSpline(float h[], /* parameterization */
+NaturalEndSpline(double h[], /* parameterization */
int z[], /* Point list */
- float dz[], /* to return the 1st derivative */
- float d2z[], /* 2nd derivative */
- float d3z[], /* 3rd derivative */
+ double dz[], /* to return the 1st derivative */
+ double d2z[], /* 2nd derivative */
+ double d3z[], /* 3rd derivative */
int npoints) /* number of valid points */
{
- float d[MAXPOINTS];
- float deltaz[MAXPOINTS], a[MAXPOINTS], b[MAXPOINTS];
+ double d[MAXPOINTS];
+ double deltaz[MAXPOINTS], a[MAXPOINTS], b[MAXPOINTS];
int i;
/* step 1 */
@@ -970,11 +964,11 @@ change(register int x,
*----------------------------------------------------------------------------*/
void
-HGtline(int x1,
- int y1)
+HGtline(int x_1,
+ int y_1)
{
- register int x0 = lastx;
- register int y0 = lasty;
+ register int x_0 = lastx;
+ register int y_0 = lasty;
register int dx;
register int dy;
register int oldcoord;
@@ -986,7 +980,7 @@ HGtline(int x1,
register int dotcounter;
if (linmod == SOLID) {
- line(x1, y1);
+ line(x_1, y_1);
return;
}
@@ -995,11 +989,11 @@ HGtline(int x1,
xinc = 1;
yinc = 1;
- if ((dx = x1 - x0) < 0) {
+ if ((dx = x_1 - x_0) < 0) {
xinc = -xinc;
dx = -dx;
}
- if ((dy = y1 - y0) < 0) {
+ if ((dy = y_1 - y_0) < 0) {
yinc = -yinc;
dy = -dy;
}
@@ -1007,48 +1001,48 @@ HGtline(int x1,
res2 = 0;
visible = 0;
if (dx >= dy) {
- oldcoord = y0;
- while (x0 != x1) {
- if ((x0 & dotcounter) && !visible) {
- change(x0, y0, 0);
+ oldcoord = y_0;
+ while (x_0 != x_1) {
+ if ((x_0 & dotcounter) && !visible) {
+ change(x_0, y_0, 0);
visible = 1;
- } else if (visible && !(x0 & dotcounter)) {
- change(x0 - xinc, oldcoord, 1);
+ } else if (visible && !(x_0 & dotcounter)) {
+ change(x_0 - xinc, oldcoord, 1);
visible = 0;
}
if (res1 > res2) {
- oldcoord = y0;
+ oldcoord = y_0;
res2 += dx - res1;
res1 = 0;
- y0 += yinc;
+ y_0 += yinc;
}
res1 += dy;
- x0 += xinc;
+ x_0 += xinc;
}
} else {
- oldcoord = x0;
- while (y0 != y1) {
- if ((y0 & dotcounter) && !visible) {
- change(x0, y0, 0);
+ oldcoord = x_0;
+ while (y_0 != y_1) {
+ if ((y_0 & dotcounter) && !visible) {
+ change(x_0, y_0, 0);
visible = 1;
- } else if (visible && !(y0 & dotcounter)) {
- change(oldcoord, y0 - yinc, 1);
+ } else if (visible && !(y_0 & dotcounter)) {
+ change(oldcoord, y_0 - yinc, 1);
visible = 0;
}
if (res1 > res2) {
- oldcoord = x0;
+ oldcoord = x_0;
res2 += dy - res1;
res1 = 0;
- x0 += xinc;
+ x_0 += xinc;
}
res1 += dx;
- y0 += yinc;
+ y_0 += yinc;
}
}
if (visible)
- change(x1, y1, 1);
+ change(x_1, y_1, 1);
else
- change(x1, y1, 0);
+ change(x_1, y_1, 0);
}
/* EOF */
diff --git a/contrib/groff/src/preproc/grn/hpoint.cpp b/contrib/groff/src/preproc/grn/hpoint.cpp
index f4e1ca8..fa24dca 100644
--- a/contrib/groff/src/preproc/grn/hpoint.cpp
+++ b/contrib/groff/src/preproc/grn/hpoint.cpp
@@ -24,26 +24,26 @@ PTInit()
* into the pointlist.
*/
POINT *
-PTMakePoint(float x,
- float y,
+PTMakePoint(double x,
+ double y,
POINT **pplist)
{
- register POINT *point;
+ register POINT *pt;
- if (Nullpoint(point = *pplist)) { /* empty list */
+ if (Nullpoint(pt = *pplist)) { /* empty list */
*pplist = (POINT *) malloc(sizeof(POINT));
- point = *pplist;
+ pt = *pplist;
} else {
- while (!Nullpoint(point->nextpt))
- point = point->nextpt;
- point->nextpt = (POINT *) malloc(sizeof(POINT));
- point = point->nextpt;
+ while (!Nullpoint(pt->nextpt))
+ pt = pt->nextpt;
+ pt->nextpt = (POINT *) malloc(sizeof(POINT));
+ pt = pt->nextpt;
}
- point->x = x;
- point->y = y;
- point->nextpt = PTInit();
- return (point);
+ pt->x = x;
+ pt->y = y;
+ pt->nextpt = PTInit();
+ return (pt);
} /* end PTMakePoint */
/* EOF */
diff --git a/contrib/groff/src/preproc/grn/main.cpp b/contrib/groff/src/preproc/grn/main.cpp
index 150b78f..c939647 100644
--- a/contrib/groff/src/preproc/grn/main.cpp
+++ b/contrib/groff/src/preproc/grn/main.cpp
@@ -90,7 +90,7 @@ extern void HGPrintElt(ELT *element, int baseline);
extern ELT *DBInit();
extern ELT *DBRead(register FILE *file);
extern POINT *PTInit();
-extern POINT *PTMakePoint(float x, float y, POINT **pplist);
+extern POINT *PTMakePoint(double x, double y, POINT **pplist);
#define SUN_SCALEFACTOR 0.70
@@ -125,7 +125,7 @@ int lastyline; /* A line's vertical position is NOT the */
/* `default' command and are reset each time the */
/* start of a picture (.GS) is found. */
-char *deffont[] =
+const char *deffont[] =
{"R", "I", "B", "S"};
int defsize[] =
{10, 16, 24, 36};
@@ -160,7 +160,7 @@ int style[STYLES] =
double scale = 1.0; /* no scaling, default */
int defpoint = 0; /* flag for pointsize scaling */
char *defstipple = (char *) 0;
-enum {
+enum E {
OUTLINE, FILL, BOTH
} polyfill;
@@ -214,7 +214,7 @@ int compatibility_flag = FALSE; /* TRUE if in compatibility mode */
void getres();
-char *doinput(FILE *fp);
+int doinput(FILE *fp);
void conv(register FILE *fp, int baseline);
void savestate();
int has_polygon(register ELT *elist);
@@ -317,7 +317,7 @@ main(int argc,
} else
fp = stdin;
- while (doinput(fp) != NULL) {
+ while (doinput(fp)) {
if (*c1 == '.' && *c2 == 'G' && *c3 == 'S') {
if (compatibility_flag ||
*c4 == '\n' || *c4 == ' ' || *c4 == '\0')
@@ -328,6 +328,8 @@ main(int argc,
fputs(inputline, stdout);
}
}
+
+ return 0;
}
@@ -389,7 +391,7 @@ getres()
/*----------------------------------------------------------------------------*
- | Routine: char * doinput (file_pointer)
+ | Routine: int doinput (file_pointer)
|
| Results: A line of input is read into `inputline'.
|
@@ -399,16 +401,14 @@ getres()
| updating `linenum'.
*----------------------------------------------------------------------------*/
-char *
+int
doinput(FILE *fp)
{
- char *k;
-
- if ((k = fgets(inputline, MAXINLINE, fp)) == NULL)
- return k;
+ if (fgets(inputline, MAXINLINE, fp) == NULL)
+ return 0;
if (strchr(inputline, '\n')) /* ++ only if it's a complete line */
linenum++;
- return (char *) !NULL;
+ return 1;
}
@@ -430,7 +430,7 @@ initpic()
thick[i] = defthick[i];
}
for (i = 0; i < FONTS; i++) { /* font name defaults */
- tfont[i] = deffont[i];
+ tfont[i] = (char *)deffont[i];
}
for (i = 0; i < SIZES; i++) { /* font size defaults */
tsize[i] = defsize[i];
@@ -488,7 +488,7 @@ conv(register FILE *fp,
strcpy(GScommand, inputline); /* save `.GS' line for later */
do {
- done = (doinput(fp) == NULL); /* test for EOF */
+ done = !doinput(fp); /* test for EOF */
flyback = (*c3 == 'F'); /* and .GE or .GF */
compat = (compatibility_flag ||
*c4 == '\n' || *c4 == ' ' || *c4 == '\0');
@@ -518,7 +518,7 @@ conv(register FILE *fp,
if (stipple == (char *) NULL) /* if user forgot stipple */
if (has_polygon(PICTURE)) /* and picture has a polygon */
- stipple = DEFSTIPPLE; /* then set the default */
+ stipple = (char *)DEFSTIPPLE; /* then set the default */
if ((temp = bottompoint - toppoint) < 0.1)
temp = 0.1;
@@ -686,8 +686,8 @@ savestate()
*----------------------------------------------------------------------------*/
void
-savebounds(float x,
- float y)
+savebounds(double x,
+ double y)
{
if (x < leftpoint)
leftpoint = x;
@@ -781,17 +781,17 @@ interpret(char *line)
case 'l': /* l */
if (isdigit(str1[1])) { /* set stipple index */
- int index = atoi(str1 + 1), val;
+ int idx = atoi(str1 + 1), val;
- if (index < 0 || index > NSTIPPLES) {
- error("bad stipple number %1 at line %2", index, linenum);
+ if (idx < 0 || idx > NSTIPPLES) {
+ error("bad stipple number %1 at line %2", idx, linenum);
break;
}
if (!defstipple_index)
defstipple_index = other_stipple_index;
val = atoi(str2);
if (val >= 0 && val < 256)
- stipple_index[index] = val;
+ stipple_index[idx] = val;
else
error("bad stipple index value at line %1", linenum);
break;
OpenPOWER on IntegriCloud