diff -ruN groff-1.18.1.3/ChangeLog groff-1.18.1.4/ChangeLog --- groff-1.18.1.3/ChangeLog 2006-10-05 23:18:32.000000000 +0200 +++ groff-1.18.1.4/ChangeLog 2006-10-14 15:03:34.000000000 +0200 @@ -1,3 +1,19 @@ +2006-10-14 Werner LEMBERG + +Version 1.18.1.4 released +========================= + + * src/devices/grohtml/post-html.cc (char_block): Fix declaration of + initializer. + + * src/preproc/grn/*: Backport CVS version 20061014. This has become + necessary because the version contained in 1.18.1.3 segfaults due + to a bug in either some versions of g++ or GNU libc. More + specifically, the crash happens with g++ 4.0.2 in combination with + libc 2.3.5 -- it disappears again with newer versions. + + * NEWS: Updated. + 2006-10-05 Werner LEMBERG Version 1.18.1.3 released diff -ruN groff-1.18.1.3/contrib/groffer/ChangeLog groff-1.18.1.4/contrib/groffer/ChangeLog --- groff-1.18.1.3/contrib/groffer/ChangeLog 2006-10-05 20:44:08.000000000 +0200 +++ groff-1.18.1.4/contrib/groffer/ChangeLog 2006-10-14 14:35:15.000000000 +0200 @@ -1,3 +1,9 @@ +2006-10-11 Bernd Warken + + ### Changes for integration in groff-1.18.1.4. + + * Makefile.sub: Remove $(SH_DEPS_SED_SCRIPT). + 2006-10-05 Bernd Warken ________________________________________________________________ * release of groffer 0.9.31 diff -ruN groff-1.18.1.3/contrib/groffer/Makefile.sub groff-1.18.1.4/contrib/groffer/Makefile.sub --- groff-1.18.1.3/contrib/groffer/Makefile.sub 2006-10-05 20:44:08.000000000 +0200 +++ groff-1.18.1.4/contrib/groffer/Makefile.sub 2006-10-14 14:30:46.000000000 +0200 @@ -5,7 +5,7 @@ # Copyright (C) 2001,2002,2005,2006 Free Software Foundation, Inc. # Written by Werner Lemberg and Bernd Warken. -# Last update: 5 Oct 2006 +# Last update: 11 Oct 2006 # This file is part of `groffer' which is part of `groff'. @@ -34,14 +34,14 @@ all: groffer -groffer: groffer.sh groffer2.sh version.sh $(SH_DEPS_SED_SCRIPT) +groffer: groffer.sh groffer2.sh version.sh $(RM) $@; - sed -f $(SH_DEPS_SED_SCRIPT) \ + sed \ -e "s|@g@|$(g)|g" \ -e "s|@BINDIR@|$(DESTDIR)$(bindir)|g" \ -e "s|@libdir@|$(DESTDIR)$(libdir)|g" \ -e "s|@VERSION@|$(version)$(revision)|g" \ - -e $(SH_SCRIPT_SED_CMD) $(srcdir)/groffer.sh >$@; + $(srcdir)/groffer.sh >$@; chmod +x $@ install_data: groffer diff -ruN groff-1.18.1.3/contrib/groffer/version.sh groff-1.18.1.4/contrib/groffer/version.sh --- groff-1.18.1.3/contrib/groffer/version.sh 2006-10-05 20:44:08.000000000 +0200 +++ groff-1.18.1.4/contrib/groffer/version.sh 2006-10-14 14:30:46.000000000 +0200 @@ -33,7 +33,7 @@ export _LAST_UPDATE; _PROGRAM_VERSION='0.9.31'; -_LAST_UPDATE='5 Oct 2006'; +_LAST_UPDATE='11 Oct 2006'; # this setting of the groff version is only used before make is run, # otherwise @VERSION@ will set it, see groffer.sh. diff -ruN groff-1.18.1.3/NEWS groff-1.18.1.4/NEWS --- groff-1.18.1.3/NEWS 2006-10-05 23:20:18.000000000 +0200 +++ groff-1.18.1.4/NEWS 2006-10-14 15:00:50.000000000 +0200 @@ -1,6 +1,13 @@ This file describes recent user-visible changes in groff. Bug fixes are not described. There are more details in the man and info pages. +VERSION 1.18.1.4 +================ + +This is a bugfix release, correcting some compilation bugs which have been +found in version 1.18.3. + + VERSION 1.18.1.3 ================ diff -ruN groff-1.18.1.3/REVISION groff-1.18.1.4/REVISION --- groff-1.18.1.3/REVISION 2002-07-21 12:34:25.000000000 +0200 +++ groff-1.18.1.4/REVISION 2006-10-14 14:32:27.000000000 +0200 @@ -1 +1 @@ -1 +1.4 diff -ruN groff-1.18.1.3/src/devices/grohtml/post-html.cc groff-1.18.1.4/src/devices/grohtml/post-html.cc --- groff-1.18.1.3/src/devices/grohtml/post-html.cc 2002-09-16 18:58:41.000000000 +0200 +++ groff-1.18.1.4/src/devices/grohtml/post-html.cc 2006-10-14 14:32:59.000000000 +0200 @@ -260,7 +260,7 @@ char_block *next; char_block(); - char_block::char_block(int length); + char_block(int length); }; char_block::char_block() diff -ruN groff-1.18.1.3/src/preproc/grn/gprint.h groff-1.18.1.4/src/preproc/grn/gprint.h --- groff-1.18.1.3/src/preproc/grn/gprint.h 2002-10-07 06:36:15.000000000 +0200 +++ groff-1.18.1.4/src/preproc/grn/gprint.h 2004-04-17 08:41:49.000000000 +0200 @@ -66,7 +66,7 @@ #define MOD 3 typedef struct point { - float x, y; + double x, y; struct point *nextpt; } POINT; diff -ruN groff-1.18.1.3/src/preproc/grn/grn.man groff-1.18.1.4/src/preproc/grn/grn.man --- groff-1.18.1.3/src/preproc/grn/grn.man 2002-10-07 06:53:55.000000000 +0200 +++ groff-1.18.1.4/src/preproc/grn/grn.man 2006-02-24 07:32:05.000000000 +0100 @@ -1,6 +1,7 @@ '\" t .ig -Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc. +Copyright (C) 2000, 2001, 2002, 2003, 2004, 2006 + 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 +18,24 @@ 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 +150,7 @@ .B .GS and .B .GE -(resp. +(and .BR .GF ) even when followed by a character other than space or newline. .\".TP @@ -188,7 +196,7 @@ 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 +210,7 @@ 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 +250,11 @@ .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 +263,10 @@ 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 @@ -331,9 +342,9 @@ .I gremlin text is now processed by .IR @g@troff , -so anything legal in a single line of +so anything valid in a single line of .I @g@troff -input is legal in a line of +input is valid in a line of .I gremlin text (barring `.' directives at the beginning of a line). Thus, it is possible to have equations within a @@ -537,7 +548,7 @@ After the points comes a line containing two decimal values, giving the brush and size for the element. The brush determines the style in which things are drawn. -For vectors, arcs, and curves there are six legal brush values: +For vectors, arcs, and curves there are six valid brush values: .sp .TS center, tab(@); @@ -550,7 +561,7 @@ 6 \(mi@@medium solid lines .TE .sp -For polygons, one more value, 0, is legal. +For polygons, one more value, 0, is valid. It specifies a polygon with an invisible border. For text, the brush selects a font as follows: .sp @@ -635,6 +646,8 @@ Daniel Senderowicz and Werner Lemberg modified it for .IR groff . . +.cp \n[grn_C] +. .\" Local Variables: .\" mode: nroff .\" End: diff -ruN groff-1.18.1.3/src/preproc/grn/hdb.cc groff-1.18.1.4/src/preproc/grn/hdb.cc --- groff-1.18.1.3/src/preproc/grn/hdb.cc 2002-10-07 06:42:55.000000000 +0200 +++ groff-1.18.1.4/src/preproc/grn/hdb.cc 2004-08-07 18:06:13.000000000 +0200 @@ -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 * @@ -17,17 +17,18 @@ #define MAXSTRING 128 #define MAXSTRING_S "127" -/* imports from main.cc */ +/* imports from main.cpp */ 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.cc */ +/* 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 @@ { 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ (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 @@ */ 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 -ruN groff-1.18.1.3/src/preproc/grn/hgraph.cc groff-1.18.1.4/src/preproc/grn/hgraph.cc --- groff-1.18.1.3/src/preproc/grn/hgraph.cc 2002-10-07 06:49:03.000000000 +0200 +++ groff-1.18.1.4/src/preproc/grn/hgraph.cc 2006-10-14 14:51:52.000000000 +0200 @@ -43,7 +43,7 @@ extern int ybottom; extern int xleft; extern int xright; -extern enum { +extern enum E { OUTLINE, FILL, BOTH } polyfill; @@ -62,17 +62,17 @@ 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); @@ -87,7 +87,7 @@ void HGPrintElt(ELT *element, - int baseline) + int /* baseline */) { register POINT *p1; register POINT *p2; @@ -166,8 +166,8 @@ * 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 */ @@ -224,8 +224,8 @@ 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"); @@ -234,8 +234,8 @@ /* 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(); @@ -413,7 +413,7 @@ /*----------------------------------------------------------------------------* - | 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. @@ -422,7 +422,7 @@ *----------------------------------------------------------------------------*/ void -dx(double x) +deltax(double x) { register int ix = (int) (x * troffscale); @@ -432,7 +432,7 @@ /*----------------------------------------------------------------------------* - | 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. @@ -442,7 +442,7 @@ *----------------------------------------------------------------------------*/ void -dy(double y) +deltay(double y) { register int iy = (int) (y * troffscale); @@ -714,9 +714,9 @@ 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; @@ -752,7 +752,7 @@ 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); @@ -780,14 +780,14 @@ 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; @@ -815,16 +815,16 @@ *----------------------------------------------------------------------------*/ 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 */ @@ -887,15 +887,15 @@ *----------------------------------------------------------------------------*/ 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 */ @@ -971,11 +971,11 @@ *----------------------------------------------------------------------------*/ 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; @@ -987,7 +987,7 @@ register int dotcounter; if (linmod == SOLID) { - line(x1, y1); + line(x_1, y_1); return; } @@ -996,11 +996,11 @@ 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; } @@ -1008,48 +1008,48 @@ 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 -ruN groff-1.18.1.3/src/preproc/grn/hpoint.cc groff-1.18.1.4/src/preproc/grn/hpoint.cc --- groff-1.18.1.3/src/preproc/grn/hpoint.cc 2000-02-20 21:52:48.000000000 +0100 +++ groff-1.18.1.4/src/preproc/grn/hpoint.cc 2004-04-17 08:41:49.000000000 +0200 @@ -24,26 +24,26 @@ * 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 -ruN groff-1.18.1.3/src/preproc/grn/main.cc groff-1.18.1.4/src/preproc/grn/main.cc --- groff-1.18.1.3/src/preproc/grn/main.cc 2002-02-10 02:22:12.000000000 +0100 +++ groff-1.18.1.4/src/preproc/grn/main.cc 2006-10-14 14:48:33.000000000 +0200 @@ -1,4 +1,4 @@ -/* Last non-groff version: main.cc 1.23 (Berkeley) 85/08/05 +/* Last non-groff version: main.c 1.23 (Berkeley) 85/08/05 * * Adapted to GNU troff by Daniel Senderowicz 99/12/29. * @@ -90,13 +90,27 @@ 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 /* #define DEFSTIPPLE "gs" */ #define DEFSTIPPLE "cf" +/* + * This grn implementation emits `.st' requests to control stipple effects, + * but groff does not (currently) support any such request. + * + * This hack disables the emission of such requests, without destroying the + * infrastructure necessary to support the feature in the future; to enable + * the emission of `.st' requests, at a future date when groff can support + * them, simply rewrite the following #define as: + * + * #define USE_ST_REQUEST stipple + * + * with accompanying comment: ``emit `.st' requests as required''. + */ +#define USE_ST_REQUEST 0 /* never emit `.st' requests */ #define MAXINLINE 100 /* input line length */ @@ -125,7 +139,7 @@ /* `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 +174,7 @@ 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; @@ -205,16 +219,16 @@ char inputline[MAXINLINE]; /* spot to filter through the file */ char *c1 = inputline; /* c1, c2, and c3 will be used to */ char *c2 = inputline + 1; /* hunt for lines that begin with */ -char *c3 = inputline + 2; /* ".GS" by looking individually */ +char *c3 = inputline + 2; /* `.GS' by looking individually */ char *c4 = inputline + 3; /* needed for compatibility mode */ -char GScommand[MAXINLINE]; /* put user's ".GS" command line here */ +char GScommand[MAXINLINE]; /* put user's `.GS' command line here */ char gremlinfile[MAXINLINE]; /* filename to use for a picture */ int SUNFILE = FALSE; /* TRUE if SUN gremlin file */ 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); @@ -316,7 +330,7 @@ } else fp = stdin; - while (doinput(fp) != NULL) { + while (doinput(fp)) { if (*c1 == '.' && *c2 == 'G' && *c3 == 'S') { if (compatibility_flag || *c4 == '\n' || *c4 == ' ' || *c4 == '\0') @@ -327,6 +341,8 @@ fputs(inputline, stdout); } } + + return 0; } @@ -388,7 +404,7 @@ /*----------------------------------------------------------------------------* - | Routine: char * doinput (file_pointer) + | Routine: int doinput (file_pointer) | | Results: A line of input is read into `inputline'. | @@ -398,16 +414,14 @@ | 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; } @@ -429,7 +443,7 @@ 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]; @@ -487,7 +501,7 @@ 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'); @@ -517,7 +531,7 @@ 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; @@ -565,7 +579,7 @@ ".sp -1\n", xright - xleft, ybottom - ytop, GScommand); - if (stipple) /* stipple requested for this picture */ + if (USE_ST_REQUEST) /* stipple requested for this picture */ printf(".st %s\n", stipple); lastx = xleft; /* note where we are (upper left */ lastyline = lasty = ytop; /* corner of the picture) */ @@ -631,7 +645,7 @@ printf("\\D't %du'\n", DEFTHICK); if (flyback) /* make sure we end up at top of */ printf(".sp -1\n"); /* picture if `flying back' */ - if (stipple) /* restore stipple to previous */ + if (USE_ST_REQUEST) /* restore stipple to previous */ printf(".st\n"); printf(".br\n" ".ft \\n(g3\n" @@ -685,8 +699,8 @@ *----------------------------------------------------------------------------*/ void -savebounds(float x, - float y) +savebounds(double x, + double y) { if (x < leftpoint) leftpoint = x; @@ -780,17 +794,17 @@ 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;