o Fix Configuration Option for readline library

o Add patch to avoid divide-by-zero trap
o Merge patches for gnuplot-3.7.1

PR:		16120
Submitted by:	Akio Morita <amorita@meadow.scphys.kyoto-u.ac.jp>
Reviewed by:	maintainer
This commit is contained in:
Steve Price 2000-01-24 06:19:03 +00:00
parent 0d2056a4f1
commit d80572ef73
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=25021
13 changed files with 3495 additions and 1 deletions

View file

@ -39,7 +39,7 @@ CONFIGURE_ARGS= --exec-prefix=${PREFIX} \
--libdir=${LOCALBASE}/lib \
--with-x --without-linux-vga \
--with-gd=${LOCALBASE}/lib \
--with-gnu-readline --with-lasergnu --with-png \
--with-readline=gnu --with-lasergnu --with-png \
--with-vflib=${LOCALBASE}/lib
MAN1= gnuplot.1 lasergnu.1

View file

@ -0,0 +1,22 @@
# key-below-clipping
--- graphics.c.ORIG Wed Sep 15 16:30:29 1999
+++ graphics.c Wed Nov 17 17:22:24 1999
@@ -1763,7 +1763,9 @@
#else
int x = xl + key_text_right - (t->h_char) * strlen(s);
#endif
- if (key_hpos == TOUT || inrange(x, xleft, xright))
+ if (key_hpos == TOUT ||
+ key_vpos == TUNDER || /* HBB 990327 */
+ inrange(x, xleft, xright))
(*t->put_text) (x, yl, s);
}
}
@@ -1820,6 +1822,7 @@
int x = xl + key_text_right - (t->h_char) * strlen(this_plot->title);
#endif
if (key_hpos == TOUT ||
+ key_vpos == TUNDER || /* HBB 990327 */
i_inrange(x, xleft, xright))
(*t->put_text) (x, yl, this_plot->title);
}

View file

@ -0,0 +1,26 @@
# hidden3d-endlessloop
--- hidden3d.c.ORIG Thu Aug 19 15:39:28 1999
+++ hidden3d.c Wed Nov 17 17:42:00 1999
@@ -2140,14 +2140,20 @@
test->tested = is_moved_or_split;
SPLIT_TEST_BY_P;
} else {
- if (loop && (p->tested == is_tested)) {
- /* Ouch, seems like we're in trouble, really */
+ if (loop && (p->tested == is_in_loop)) {
+ /* Ouch, seems like we're in trouble, really: no way to
+ * split one of them, and we're in a loop, so we can't
+ * move p to the front of the list, without risking an
+ * endless loop. Well, let's just output the darn thing,
+ * then, no matter what. :-( */
+#if DEBUG /* normally off */
fprintf(stderr, "\
#Failed: In loop, without intersections.\n\
#Relations are %d, %d\n",
p_rel_tplane, t_rel_pplane);
print_polygon(test, "test");
print_polygon(p, "p");
+#endif
continue; /* Keep quiet, maybe no-one will notice (;-) */
} else {
PUT_P_IN_FRONT_TEST(is_in_loop);

View file

@ -0,0 +1,103 @@
# table-format.2
--- plot2d.c.ORIG Mon Oct 11 13:18:56 1999
+++ plot2d.c Thu Nov 18 19:13:48 1999
@@ -718,12 +718,22 @@
int plot_num;
{
int i, curve;
+ char *table_format = NULL;
+
+ /* The data format is determined by the format of the axis labels.
+ * See 'set format'. Patch by Don Taber
+ */
+ table_format = gp_alloc(strlen(xformat)+strlen(yformat)+5, "table format");
+ strcpy(table_format, xformat);
+ strcat(table_format, " ");
+ strcat(table_format, yformat);
+ strcat(table_format, " %c\n");
for (curve = 0; curve < plot_num;
curve++, this_plot = this_plot->next_cp) {
fprintf(gpoutfile, "#Curve %d, %d points\n#x y type\n", curve, this_plot->p_count);
for (i = 0; i < this_plot->p_count; i++) {
- fprintf(gpoutfile, "%g %g %c\n",
+ fprintf(gpoutfile, table_format,
this_plot->points[i].x,
this_plot->points[i].y,
this_plot->points[i].type == INRANGE ? 'i'
@@ -732,9 +742,12 @@
}
fputc('\n', gpoutfile);
}
-/* two blank lines between plots in table output */
+
+ /* two blank lines between plots in table output */
fputc('\n', gpoutfile);
fflush(gpoutfile);
+
+ free(table_format);
}
/*
--- plot3d.c.ORIG Thu Dec 10 18:30:52 1998
+++ plot3d.c Thu Nov 18 19:12:01 1999
@@ -694,6 +694,17 @@
int i, curve, surface;
struct iso_curve *icrvs;
struct coordinate GPHUGE *points;
+ char *table_format = NULL;
+ char *pcat;
+
+ table_format = gp_alloc(strlen(xformat)+strlen(yformat)+strlen(zformat)+6,
+ "table format");
+ strcpy(table_format, xformat);
+ strcat(table_format, " ");
+ strcat(table_format, yformat);
+ strcat(table_format, " ");
+ strcat(table_format, zformat);
+ pcat = &table_format[strlen(table_format)];
for (surface = 0, this_plot = first_3dplot; surface < pcount;
this_plot = this_plot->next_sp, surface++) {
@@ -702,12 +713,13 @@
curve = 0;
if (draw_surface) {
+ strcpy(pcat," %c\n");
/* only the curves in one direction */
while (icrvs && curve < this_plot->num_iso_read) {
fprintf(gpoutfile, "\n#IsoCurve %d, %d points\n#x y z type\n",
curve, icrvs->p_count);
for (i = 0, points = icrvs->points; i < icrvs->p_count; i++) {
- fprintf(gpoutfile, "%g %g %g %c\n",
+ fprintf(gpoutfile, table_format,
points[i].x,
points[i].y,
points[i].z,
@@ -723,6 +735,7 @@
if (draw_contour) {
int number = 0;
struct gnuplot_contours *c = this_plot->contours;
+ strcpy(pcat,"\n");
while (c) {
int count = c->num_pts;
struct coordinate GPHUGE *p = c->coords;
@@ -732,7 +745,8 @@
/* double blank line to allow plot ... index ... */
fprintf(gpoutfile, "\n# Contour %d, label: %s\n", number++, c->label);
for (; --count >= 0; ++p)
- fprintf(gpoutfile, "%g %g %g\n", p->x, p->y, p->z);
+ fprintf(gpoutfile, table_format, p->x, p->y, p->z);
+
/* blank line between segments of same contour */
putc('\n', gpoutfile);
c = c->next;
@@ -740,6 +754,8 @@
}
}
fflush(gpoutfile);
+
+ free(table_format);
}

View file

@ -0,0 +1,80 @@
# contour.c.fix.991130
--- contour.c.ORIG Thu Dec 3 22:23:46 1998
+++ contour.c Wed Dec 1 21:07:24 1999
@@ -536,8 +536,8 @@
struct edge_struct **p_edges; /* list of edges output */
{
int i, j, grid_x_max = iso_lines->p_count;
- struct edge_struct *p_edge1, *p_edge2, *edge0, *edge1, *edge2, *pe_tail,
- *pe_tail1, *pe_tail2, *pe_temp;
+ struct edge_struct *p_edge1, *p_edge2, *edge0, *edge1, *edge2,
+ *pe_tail, *pe_tail2, *pe_temp;
struct poly_struct *pp_tail, *lower_tri, *upper_tri;
struct coordinate GPHUGE *p_vrtx1, GPHUGE * p_vrtx2; /* HBB 980308: need to tag *each* of them as GPHUGE! */
@@ -545,14 +545,14 @@
(*p_edges) = pe_tail = NULL;
p_vrtx1 = iso_lines->points; /* first row of vertices */
- p_edge1 = pe_tail1 = NULL; /* clear list of edges */
+ p_edge1 = pe_tail = NULL; /* clear list of edges */
/* Generate edges of first row */
+ /* HBB 19991130: removed effectively unused variable 'pe_tail1' */
for (j = 0; j < grid_x_max - 1; j++)
- add_edge(p_vrtx1 + j, p_vrtx1 + j + 1, &p_edge1, &pe_tail1);
+ add_edge(p_vrtx1 + j, p_vrtx1 + j + 1, &p_edge1, &pe_tail);
(*p_edges) = p_edge1; /* update main list */
- pe_tail = pe_tail1;
/*
@@ -562,10 +562,16 @@
* (pe_tail points on last edge).
*
* Temporary pointers:
- * 1. p_edge2: Top horizontal edge list: ----------------------- 2
- * 2. pe_tail: middle edge list: |\ |\ |\ |\ |\ |\ |
+ * 1. p_edge2: Top horizontal edge list: +-----------------------+ 2
+ * 2. p_tail : end of middle edge list: |\ |\ |\ |\ |\ |\ |
* | \| \| \| \| \| \|
- * 3. p_edge1: Bottom horizontal edge list: ----------------------- 1
+ * 3. p_edge1: Bottom horizontal edge list: +-----------------------+ 1
+ *
+ * pe_tail2 : end of list beginning at p_edge2
+ * pe_temp : position inside list beginning at p_edge1
+ * p_edges : head of the master edge list (part of our output)
+ * p_vrtx1 : start of lower row of input vertices
+ * p_vrtx2 : start of higher row of input vertices
*
* The routine generates two triangle Lower Upper 1
* upper one and lower one: | \ ----
@@ -633,14 +639,21 @@
upper_tri = add_poly(edge0, edge1, edge2, p_polys, &pp_tail);
}
- if ((*p_edges)) { /* Chain new edges to main list. */
- pe_tail->next = p_edge2;
- pe_tail = pe_tail2;
- } else {
- (*p_edges) = p_edge2;
- pe_tail = pe_tail2;
+ if (p_edge2) {
+ /* HBB 19991130 bugfix: if p_edge2 list is empty,
+ * don't change p_edges list! Crashes by access
+ * to NULL pointer pe_tail, the second time through,
+ * otherwise */
+ if ((*p_edges)) { /* Chain new edges to main list. */
+ pe_tail->next = p_edge2;
+ pe_tail = pe_tail2;
+ } else {
+ (*p_edges) = p_edge2;
+ pe_tail = pe_tail2;
+ }
}
+ /* this row finished, move list heads up one row: */
p_edge1 = p_edge2;
p_vrtx1 = p_vrtx2;
}

View file

@ -0,0 +1,15 @@
# contour-clipping.991202
--- contour.c.ORIG Thu Dec 2 15:15:03 1999
+++ contour.c Thu Dec 2 15:13:53 1999
@@ -727,7 +727,11 @@
{
struct edge_struct *pe_temp = NULL;
+#if 1
+ if (point0->type == INRANGE && point1->type == INRANGE) {
+#else
if (point0->type != UNDEFINED && point1->type != UNDEFINED) {
+#endif
pe_temp = (struct edge_struct *)
gp_alloc((unsigned long) sizeof(struct edge_struct), "contour edge");

View file

@ -0,0 +1,236 @@
# vector-clip
--- graphics.c.ORIG Wed Sep 15 16:30:29 1999
+++ graphics.c Thu Dec 2 13:16:57 1999
@@ -1369,7 +1369,6 @@
/* label first y axis tics */
if (ytics) {
- int axis = map_x(ZERO);
/* set the globals ytick2d_callback() needs */
if (rotate_ytics && (*t->text_angle) (1)) {
@@ -1388,8 +1387,8 @@
else
tic_mirror = -1; /* no thank you */
- if ((ytics & TICS_ON_AXIS) && !log_array[FIRST_X_AXIS] && inrange(axis, xleft, xright)) {
- tic_start = axis;
+ if ((ytics & TICS_ON_AXIS) && !log_array[FIRST_X_AXIS] && inrange(0.0, x_min, x_max)) {
+ tic_start = map_x(0.0);
tic_direction = -1;
if (ytics & TICS_MIRROR)
tic_mirror = tic_start;
@@ -1409,7 +1408,6 @@
}
/* label first x axis tics */
if (xtics) {
- int axis = map_y(ZERO);
/* set the globals xtick2d_callback() needs */
if (rotate_xtics && (*t->text_angle) (1)) {
@@ -1426,8 +1424,8 @@
tic_mirror = ytop;
else
tic_mirror = -1; /* no thank you */
- if ((xtics & TICS_ON_AXIS) && !log_array[FIRST_Y_AXIS] && inrange(axis, ybot, ytop)) {
- tic_start = axis;
+ if ((xtics & TICS_ON_AXIS) && !log_array[FIRST_Y_AXIS] && inrange(0.0, y_min, y_max)) {
+ tic_start = map_y(0.0);
tic_direction = -1;
if (xtics & TICS_MIRROR)
tic_mirror = tic_start;
@@ -1454,7 +1452,6 @@
/* label second y axis tics */
if (y2tics) {
/* set the globalss ytick2d_callback() needs */
- int axis = map_x(ZERO);
if (rotate_y2tics && (*t->text_angle) (1)) {
tic_hjust = CENTRE;
@@ -1470,8 +1467,8 @@
tic_mirror = xleft;
else
tic_mirror = -1; /* no thank you */
- if ((y2tics & TICS_ON_AXIS) && !log_array[FIRST_X_AXIS] && inrange(axis, xleft, xright)) {
- tic_start = axis;
+ if ((y2tics & TICS_ON_AXIS) && !log_array[FIRST_X_AXIS] && inrange(0.0, x_min, x_max)) {
+ tic_start = map_x(0.0);
tic_direction = 1;
if (y2tics & TICS_MIRROR)
tic_mirror = tic_start;
@@ -1490,7 +1487,6 @@
}
/* label second x axis tics */
if (x2tics) {
- int axis = map_y(ZERO);
/* set the globals xtick2d_callback() needs */
if (rotate_x2tics && (*t->text_angle) (1)) {
@@ -1507,8 +1503,8 @@
tic_mirror = ybot;
else
tic_mirror = -1; /* no thank you */
- if ((x2tics & TICS_ON_AXIS) && !log_array[SECOND_Y_AXIS] && inrange(axis, ybot, ytop)) {
- tic_start = axis;
+ if ((x2tics & TICS_ON_AXIS) && !log_array[SECOND_Y_AXIS] && inrange(0.0, y_min, y_max)) {
+ tic_start = map_y(0.0);
tic_direction = 1;
if (x2tics & TICS_MIRROR)
tic_mirror = tic_start;
@@ -1560,45 +1556,58 @@
x_axis = FIRST_X_AXIS;
y_axis = FIRST_Y_AXIS; /* chose scaling */
- axis_zero[FIRST_Y_AXIS] = map_y(0.0);
- axis_zero[FIRST_X_AXIS] = map_x(0.0);
- if (axis_zero[FIRST_Y_AXIS] < ybot || is_log_y)
+ if (y_min >= 0.0 && y_max >= 0.0 || is_log_y)
axis_zero[FIRST_Y_AXIS] = ybot; /* save for impulse plotting */
- else if (axis_zero[FIRST_Y_AXIS] >= ytop)
+ else if (y_min <= 0.0 && y_max <= 0.0)
axis_zero[FIRST_Y_AXIS] = ytop;
- else if (xzeroaxis.l_type > -3) {
- term_apply_lp_properties(&xzeroaxis);
- (*t->move) (xleft, axis_zero[FIRST_Y_AXIS]);
- (*t->vector) (xright, axis_zero[FIRST_Y_AXIS]);
- }
- if ((yzeroaxis.l_type > -3) && !is_log_x
- && axis_zero[FIRST_X_AXIS] >= xleft
- && axis_zero[FIRST_X_AXIS] < xright) {
- term_apply_lp_properties(&yzeroaxis);
- (*t->move) (axis_zero[FIRST_X_AXIS], ybot);
- (*t->vector) (axis_zero[FIRST_X_AXIS], ytop);
+ else {
+ axis_zero[FIRST_X_AXIS] = map_y(0.0);
+ if (xzeroaxis.l_type > -3) {
+ term_apply_lp_properties(&xzeroaxis);
+ (*t->move) (xleft, axis_zero[FIRST_Y_AXIS]);
+ (*t->vector) (xright, axis_zero[FIRST_Y_AXIS]);
+ }
+ }
+ if (x_min >= 0.0 && x_max >= 0.0)
+ axis_zero[FIRST_Y_AXIS] = xleft;
+ else if (x_min <= 0.0 && x_max <= 0.0)
+ axis_zero[FIRST_Y_AXIS] = xright;
+ else {
+ axis_zero[FIRST_Y_AXIS] = map_x(0.0);
+ if ((yzeroaxis.l_type > -3) && !is_log_x) {
+ term_apply_lp_properties(&yzeroaxis);
+ (*t->move) (axis_zero[FIRST_X_AXIS], ybot);
+ (*t->vector) (axis_zero[FIRST_X_AXIS], ytop);
+ }
}
+
x_axis = SECOND_X_AXIS;
y_axis = SECOND_Y_AXIS; /* chose scaling */
- axis_zero[SECOND_Y_AXIS] = map_y(0.0);
- axis_zero[SECOND_X_AXIS] = map_x(0.0);
- if (axis_zero[SECOND_Y_AXIS] < ybot || is_log_y2)
+ if (is_log_y2 || y_min >= 0.0 && y_max >= 0.0)
axis_zero[SECOND_Y_AXIS] = ybot; /* save for impulse plotting */
- else if (axis_zero[SECOND_Y_AXIS] >= ytop)
+ else if (y_min <= 0.0 && y_max <= 0.0)
axis_zero[SECOND_Y_AXIS] = ytop;
- else if (x2zeroaxis.l_type > -3) {
- term_apply_lp_properties(&x2zeroaxis);
- (*t->move) (xleft, axis_zero[SECOND_Y_AXIS]);
- (*t->vector) (xright, axis_zero[SECOND_Y_AXIS]);
- }
- if ((y2zeroaxis.l_type > -3) && !is_log_x2 &&
- axis_zero[SECOND_X_AXIS] >= xleft &&
- axis_zero[SECOND_X_AXIS] < xright) {
- term_apply_lp_properties(&y2zeroaxis);
- (*t->move) (axis_zero[SECOND_X_AXIS], ybot);
- (*t->vector) (axis_zero[SECOND_X_AXIS], ytop);
+ else {
+ axis_zero[SECOND_X_AXIS] = map_y(0.0);
+ if (x2zeroaxis.l_type > -3) {
+ term_apply_lp_properties(&x2zeroaxis);
+ (*t->move) (xleft, axis_zero[SECOND_Y_AXIS]);
+ (*t->vector) (xright, axis_zero[SECOND_Y_AXIS]);
+ }
+ }
+ if (y_min >= 0.0 && y_max >= 0.0)
+ axis_zero[SECOND_Y_AXIS] = xleft;
+ else if (x_min <= 0.0 && x_max <= 0.0)
+ axis_zero[SECOND_Y_AXIS] = xright;
+ else {
+ axis_zero[SECOND_Y_AXIS] = map_x(0.0);
+ if ((y2zeroaxis.l_type > -3) && !is_log_x2) {
+ term_apply_lp_properties(&y2zeroaxis);
+ (*t->move) (axis_zero[SECOND_X_AXIS], ybot);
+ (*t->vector) (axis_zero[SECOND_X_AXIS], ytop);
+ }
}
/* DRAW PLOT BORDER */
if (draw_border) {
@@ -2739,14 +2748,61 @@
int i;
int x1, y1, x2, y2;
struct termentry *t = term;
+ TBOOLEAN head;
+ struct coordinate GPHUGE points[2];
+ double ex, ey;
+ double lx[2], ly[2];
for (i = 0; i < plot->p_count; i++) {
- if (plot->points[i].type == INRANGE) {
- x1 = map_x(plot->points[i].xlow);
- y1 = map_y(plot->points[i].ylow);
- x2 = map_x(plot->points[i].xhigh);
- y2 = map_y(plot->points[i].yhigh);
- (*t->arrow) (x1, y1, x2, y2, TRUE);
+ points[0] = plot->points[i];
+ points[1].x = plot->points[i].xhigh;
+ points[1].y = plot->points[i].yhigh;
+ if (inrange(points[1].x, x_min, x_max) &&
+ inrange(points[1].y, y_min, y_max)) {
+ /* to inrange */
+ points[1].type = INRANGE;
+ x2 = map_x(points[1].x);
+ y2 = map_y(points[1].y);
+ head = TRUE;
+ if (points[0].type == INRANGE) {
+ x1 = map_x(points[0].x);
+ y1 = map_y(points[0].y);
+ (*t->arrow) (x1, y1, x2, y2, head);
+ } else if (points[0].type == OUTRANGE) {
+ /* from outrange to inrange */
+ if (clip_lines1) {
+ edge_intersect(points, 1, &ex, &ey);
+ x1 = map_x(ex);
+ y1 = map_y(ey);
+ (*t->arrow) (x1, y1, x2, y2, head);
+ }
+ }
+ } else {
+ /* to outrange */
+ points[1].type = OUTRANGE;
+ head = FALSE;
+ if (points[0].type == INRANGE) {
+ /* from inrange to outrange */
+ if (clip_lines1) {
+ x1 = map_x(points[0].x);
+ y1 = map_y(points[0].y);
+ edge_intersect(points, 1, &ex, &ey);
+ x2 = map_x(ex);
+ y2 = map_y(ey);
+ (*t->arrow) (x1, y1, x2, y2, head);
+ }
+ } else if (points[0].type == OUTRANGE) {
+ /* from outrange to outrange */
+ if (clip_lines2) {
+ if (two_edge_intersect(points, 1, lx, ly)) {
+ x1 = map_x(lx[0]);
+ y1 = map_y(ly[0]);
+ x2 = map_x(lx[1]);
+ y2 = map_y(ly[1]);
+ (*t->arrow) (x1, y1, x2, y2, head);
+ }
+ }
+ }
}
}
}

View file

@ -0,0 +1,460 @@
# png-web216.4
--- bitmap.c.ORIG Mon Oct 11 18:10:54 1999
+++ bitmap.c Thu Dec 2 20:41:29 1999
@@ -1,5 +1,5 @@
#ifndef lint
-static char *RCSid = "$Id: bitmap.c,v 1.2.2.2 1999/10/11 17:10:54 lhecking Exp $";
+static char *RCSid = "$Id: bitmap.c,v 1.2.2.3 1999/11/30 15:07:49 lhecking Exp $";
#endif
/* GNUPLOT - bitmap.c */
@@ -846,8 +846,6 @@
}
-/* Currently unused */
-#if 1 /* HBB 991008: used by PNG, now */
/*
* get pixel (x,y) value
*/
@@ -857,7 +855,7 @@
{
register unsigned int row;
register unsigned char mask;
- register unsigned char value;
+ register unsigned char value = 0;
int i;
if (b_rastermode) {
@@ -876,10 +874,10 @@
row -= b_psize;
value <<= 1;
}
- return(value);
- }
- else
- {
+/* HBB 991123: the missing '>>1' was the 'every second color' problem
+ * with PNG in 3.8a...*/
+ return(value>>1);
+ } else {
#ifdef BITMAPDEBUG
if (b_rastermode)
fprintf(stderr, "Warning: getpixel(%d,%d) out of bounds\n",
@@ -890,7 +888,6 @@
return(0);
}
}
-#endif /* 0 */
/*
--- bitmap.h.ORIG Wed Sep 29 14:48:16 1999
+++ bitmap.h Thu Dec 2 20:41:29 1999
@@ -1,4 +1,4 @@
-/* $Id: bitmap.h,v 1.1.1.2.2.1 1999/09/29 13:48:16 lhecking Exp $ */
+/* $Id: bitmap.h,v 1.1.1.2.2.2 1999/11/30 15:07:49 lhecking Exp $ */
/* GNUPLOT - bitmap.h */
@@ -101,7 +101,7 @@
void b_makebitmap __PROTO((unsigned int x, unsigned int y, unsigned int planes));
void b_freebitmap __PROTO((void));
void b_setpixel __PROTO((unsigned int x, unsigned int y, unsigned int value));
-/* unused unsigned int b_getpixel __PROTO((unsigned int x, unsigned int y)); */
+unsigned int b_getpixel __PROTO((unsigned int x, unsigned int y));
void b_line __PROTO((unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2));
void b_setmaskpixel __PROTO((unsigned int x, unsigned int y, unsigned int value));
/* void b_putc __PROTO((unsigned int x, unsigned int y, char c, unsigned int angle)); */
--- term/png.trm.ORIG Tue Oct 19 14:31:28 1999
+++ term/png.trm Thu Dec 2 20:42:20 1999
@@ -1,5 +1,5 @@
/*
- * $Id: png.trm,v 1.11.2.5 1999/10/19 13:31:28 lhecking Exp $
+ * $Id: png.trm,v 1.11.2.8 1999/11/30 15:08:44 lhecking Exp $
*
*/
@@ -42,8 +42,11 @@
* png
*
* AUTHORS
- * Alexander Lehmann original code,
- * derived from pbm.trm by Russell Lang.
+ * Alexander Lehmann
+ * derived from pbm.trm by Russell Lang
+ *
+ * Eric S. Raymond update for pnglib-1.0.3; transparency.
+ * H.-B. Broeker fixes to Eric's changes
*
* send your comments or suggestions to (info-gnuplot@dartmouth.edu).
*
@@ -100,56 +103,97 @@
static int png_font = 1; /* small font */
static int png_mode = 0; /* 0:monochrome 1:gray 2:color */
+static int png_transparent = 0; /* generate transparent first color */
/* 7=black, 0=white */
static int png_gray[] = { 7, 1, 6, 5, 4, 3, 2, 1, 7 }; /* grays */
-/* bit3=!intensify, bit2=!red, bit1=!green, bit0=!blue */
-static int png_color_table[] ={ 15, 8, 3, 5, 6, 4, 2, 1, 11, 13, 14 }; /* colors */
-static png_color png_palette[16];
+static png_color png_palette[WEB_N_COLORS];
TERM_PUBLIC void
PNG_options()
{
- png_font = 1; /* small */
- png_mode = 0;
+ unsigned short rgb_color[3];
+ int n_colors = 0;
+ char *string;
+ int i;
+
+ rgb_color[0] = 0;
+ rgb_color[1] = 0;
+ rgb_color[2] = 0;
+
+ png_font = 1; /* small */
+ png_mode = 2; /* color */
+ png_transparent = 0; /* use opaque image background */
term_options[0] = NUL;
while (!END_OF_COMMAND) {
- if (almost_equals(c_token, "s$mall"))
- png_font = 1;
- else if (almost_equals(c_token, "me$dium"))
- png_font = 2;
- else if (almost_equals(c_token, "l$arge"))
- png_font = 3;
- else if (almost_equals(c_token, "mo$nochrome"))
- png_mode = 0;
- else if (almost_equals(c_token, "g$ray"))
- png_mode = 1;
- else if (almost_equals(c_token, "c$olor")
- || almost_equals(c_token, "c$olour"))
- png_mode = 2;
- else {
- /* reset to default, since term is already set */
- png_font = 1;
- png_mode = 0;
- int_error("expecting: {small, medium, large}, or {monochrome, gray, color}", c_token);
- }
- c_token++;
+ if (almost_equals(c_token, "s$mall"))
+ png_font = 1;
+ else if (almost_equals(c_token, "me$dium"))
+ png_font = 2;
+ else if (almost_equals(c_token, "l$arge"))
+ png_font = 3;
+ else if (almost_equals(c_token, "mo$nochrome"))
+ png_mode = 0;
+ else if (almost_equals(c_token, "g$ray"))
+ png_mode = 1;
+ else if (almost_equals(c_token, "c$olor")
+ || almost_equals(c_token, "c$olour"))
+ png_mode = 2;
+ else if (almost_equals(c_token, "t$ransparent"))
+ png_transparent = 1;
+ else if (almost_equals(c_token, "not$ransparent"))
+ png_transparent = 0;
+ else {
+ /* set color */
+ string = input_line + token[c_token].start_index;
+
+ if (string[0] == 'x') {
+ /* HBB 991123: read in as *shorts*, not ints! */
+ if (sscanf(string, "x%2hx%2hx%2hx", &rgb_color[0], &rgb_color[1], &rgb_color[2] ) != 3) {
+ int_error("invalid color spec, must be xRRGGBB", c_token);
+ }
+ } else
+ int_error("expecting: {small, medium, large},[no]transparent, or {monochrome, gray, color, [xRRGGBB] }", c_token);
+
+ if (n_colors >= WEB_N_COLORS) {
+ int_warn("too many colors, ingoring", c_token);
+ /* Magic number abuse guards against
+ * "> WEB_N_COLORS warning" scroll fests. */
+ if (!END_OF_COMMAND) {
+ while (!END_OF_COMMAND)
+ ++c_token; --c_token;
+ }
+ } else {
+ web_color_rgbs[n_colors].r = rgb_color[0];
+ web_color_rgbs[n_colors].g = rgb_color[1];
+ web_color_rgbs[n_colors].b = rgb_color[2];
+ n_colors++;
+ }
+ }
+ c_token++;
}
/* setup options string */
+ /* HBB 991008: moved this block to here, so 'transparent' gets
+ * printed out first. Don't print 'notransparent', for now, to
+ * protect older gnuplots. Scripts with 'transparent' in them
+ * won't work as wanted, with older versions, so put it here. */
+ if (png_transparent)
+ strcat(term_options, "transparent");
+
switch (png_font) {
case 3:
- strcat(term_options, "large");
+ strcat(term_options, " large");
break;
case 2:
- strcat(term_options, "medium");
+ strcat(term_options, " medium");
break;
case 1:
default:
- strcat(term_options, "small");
+ strcat(term_options, " small");
break;
}
@@ -166,6 +210,13 @@
break;
}
+ for (i=0; i < n_colors ; i++ ) {
+ sprintf(term_options,"%s x%02x%02x%02x",
+ term_options,
+ web_color_rgbs[i].r,
+ web_color_rgbs[i].g,
+ web_color_rgbs[i].b);
+ }
}
@@ -222,7 +273,7 @@
switch (png_mode) {
case 2:
- numplanes = 4;
+ numplanes = 8;
break;
case 1:
numplanes = 3;
@@ -248,15 +299,15 @@
TERM_PUBLIC void
PNG_text()
{
- register int x, j, row;
png_structp png_ptr;
png_infop info_ptr;
- register int i, value;
png_bytep prow;
- int mask, plane1, plane2, plane3, plane4;
- int red, green, blue;
png_text pngtext, *pngtext_copy;
+ png_byte pal_trans[1];
char text[100];
+ register int x, i, j;
+/* register int row, value; */
+/* int mask, plane1, plane2, plane3, plane4; */
png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
if (!png_ptr) {
@@ -275,6 +326,7 @@
b_freebitmap();
return;
}
+ memset(prow,0,sizeof(prow));
if (setjmp(png_ptr->jmpbuf)) {
png_destroy_write_struct(&png_ptr, &info_ptr);
free(prow);
@@ -283,7 +335,7 @@
}
#ifdef __OLD_PNGLIB__
- /* deprecated and no longer necessary */
+ /* deprecated and no longer necessary */
png_info_init(info_ptr);
png_write_init(png_ptr); */
#endif /* __OLD_PNGLIB__ */
@@ -293,43 +345,48 @@
info_ptr->width = b_ysize;
info_ptr->height = b_xsize;
- info_ptr->bit_depth = png_mode == 0 ? 1 : 4;
+ info_ptr->bit_depth = png_mode == 0 ? 1 : 8;
info_ptr->color_type = png_mode == 2 ? PNG_COLOR_TYPE_PALETTE :
PNG_COLOR_TYPE_GRAY;
if (png_mode == 2) {
info_ptr->valid |= PNG_INFO_PLTE;
info_ptr->palette = png_palette;
- info_ptr->num_palette = 16;
+ info_ptr->num_palette = sizeof(png_palette)/sizeof(png_palette[0]);
}
if (png_mode != 0) {
info_ptr->valid |= PNG_INFO_sBIT;
if (png_mode == 1) {
info_ptr->sig_bit.gray = 3;
png_set_shift(png_ptr, &(info_ptr->sig_bit));
- } else {
- info_ptr->sig_bit.red = 2;
- info_ptr->sig_bit.green = 2;
- info_ptr->sig_bit.blue = 2;
+ }
+ else {
+ /* HBB 991123: we're now using the full 8 bits per color
+ * component... */
+ info_ptr->sig_bit.red = 8;
+ info_ptr->sig_bit.green = 8;
+ info_ptr->sig_bit.blue = 8;
}
}
+
info_ptr->interlace_type = 0;
+
if (png_mode == 0)
png_set_invert_mono(png_ptr);
- if (png_mode == 2)
- for (i = 0; i < 16; i++) {
- red = (i & 4) ? 1 : 3;
- green = (i & 2) ? 1 : 3;
- blue = (i & 1) ? 1 : 3;
- if (i & 8) {
- red--;
- green--;
- blue--;
- }
- png_palette[i].red = red * 85;
- png_palette[i].green = green * 85;
- png_palette[i].blue = blue * 85;
+ if (png_mode == 2) {
+ if (png_transparent) {
+ info_ptr->valid |= PNG_INFO_tRNS;
+ info_ptr->num_trans = 1;
+ pal_trans[0] = 0;
+ info_ptr->trans=pal_trans;
}
+
+ for (i = 0; i < WEB_N_COLORS; i++) {
+ png_palette[i].red = web_color_rgbs[i].r;
+ png_palette[i].green = web_color_rgbs[i].g;
+ png_palette[i].blue = web_color_rgbs[i].b;
+ }
+ }
sprintf(text, "gnuplot %sversion %s patchlevel %s",
OS, version, patchlevel);
@@ -339,6 +396,13 @@
pngtext.text_length = strlen(text);
pngtext_copy = malloc(sizeof(*pngtext_copy));
+ if (!pngtext_copy) {
+ png_destroy_write_struct(&png_ptr, &info_ptr);
+ free(prow);
+ b_freebitmap();
+ return;
+ }
+ memset(pngtext_copy,0,sizeof(pngtext_copy));
*pngtext_copy = pngtext;
info_ptr->num_text = 1;
info_ptr->text = pngtext_copy;
@@ -353,6 +417,7 @@
/* dump bitmap in raster mode */
for (x = b_xsize - 1; x >= 0; x--) {
+#if 0
row = (b_ysize / 8) - 1;
for (j = row; j >= 0; j--) {
mask = 0x80;
@@ -382,10 +447,14 @@
if (png_mode == 1)
value = 7 - value;
- prow[(row - j) * 8 + i] = (png_byte) value;
+ prow[(row - j) * 8 + i] = (png_byte) (value & 0xFF) ;
mask >>= 1;
}
}
+#else
+ for (j=b_ysize - 1; j>= 0; j--)
+ prow[j] = (png_byte)b_getpixel(j, x);
+#endif
png_write_rows(png_ptr, &prow, 1);
}
@@ -395,16 +464,42 @@
b_freebitmap();
}
-
+/* _linetype(lt) Called to set the line type before text is displayed or
+ * line(s) plotted. This procedure should select a pen color or line
+ * style if the device has these capabilities.
+ * lt is an integer from -2 to 0 or greater.
+ * An lt of -2 is used for the border of the plot.
+ * An lt of -1 is used for the X and Y axes.
+ * lt 0 and upwards are used for plots 0 and upwards.
+ * If _linetype() is called with lt greater than the available line types,
+ * it should map it to one of the available line types.
+ * Most drivers provide 9 different linetypes (lt is 0 to 8).
+ */
TERM_PUBLIC void
PNG_linetype(linetype)
int linetype;
{
switch (png_mode) {
+ /* HBB 991008: this once made the grid lines and axes (-1) look the
+ * same as the borders (-2). That's ugly, IMHO. GIF uses a
+ * dashed line, for this, but libpng doesn't seem able to do
+ * that. But a look into the palette turns up that color 2
+ * is grey, and is currently unused... Let's see: */
case 2:
- if (linetype >= 9)
- linetype %= 9;
- b_setvalue(png_color_table[linetype + 2]);
+
+ if (linetype == -2)
+ linetype = 1;
+ else if (linetype == -1)
+ linetype = 2;
+
+ else {
+ /* HBB 991008: moved the += 3 down, so colors 0, 1, 2 are
+ * _not_ used by the regular plots, as it should be */
+ if (linetype >= (WEB_N_COLORS - 3))
+ linetype %= (WEB_N_COLORS - 3);
+ linetype += 3;
+ }
+ b_setvalue(linetype);
break;
case 1:
if (linetype >= 7)
@@ -462,13 +557,26 @@
"?png",
" The `png` terminal driver supports Portable Network Graphics. To compile it,",
" you will need the third-party libraries \"libpng\" and \"zlib\"; both are",
-" available at ftp://ftp.uu.net/graphics/png. `png` has two options.",
+" available at http://www.cdrom.com/pub/png/. `png` has four options.",
+"",
+" By default, the `png` terminal driver uses a shared Web-friendy palette.",
"",
" Syntax:",
" set terminal png {small | medium | large}",
+" {transparent | notransparent}",
" {monochrome | gray | color}",
+" {<color0> <color1> <color2> ...}",
+"",
+" `transparent` instructs the driver to generate transparent PNGs. The first",
+" color will be the transparent one.",
+"",
+" The defaults are small (fontsize) and color. Default size of the output",
+" is 640*480 pixel. ",
"",
-" The defaults are small (fontsize) and monochrome. Default size of the output",
-" is 640*480 pixel."
+" Each color must be of the form 'xrrggbb', where x is the literal character",
+" 'x' and 'rrggbb' are the red, green and blue components in hex. For example,",
+" 'x00ff00' is green. The background color is set first, then the border",
+" colors, then the X & Y axis colors, then the plotting colors. The maximum",
+" number of colors that can be set is currently 99."
END_HELP(png)
#endif /* TERM_HELP */

2118
math/gnuplot+/files/patch-xi Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,13 @@
# save-position
--- misc.c.ORIG Wed Sep 29 18:17:27 1999
+++ misc.c Sun Dec 5 21:46:23 1999
@@ -1006,8 +1006,7 @@
FILE *fp;
struct position *pos;
{
- static char *msg[] =
- {"first_axes ", "second axes ", "graph ", "screen "};
+ static char *msg[] = { "first ", "second ", "graph ", "screen " };
assert(first_axes == 0 && second_axes == 1 && graph == 2 && screen == 3);

View file

@ -0,0 +1,283 @@
# command-substitution
--- command.c.ORIG Thu Aug 19 15:42:21 1999
+++ command.c Thu Dec 9 17:13:18 1999
@@ -248,7 +248,7 @@
(void) fputs("!\n", stderr); /* why do we need this ? */
return (0);
}
- num_tokens = scanner(input_line);
+ num_tokens = scanner(&input_line, &input_line_len);
c_token = 0;
while (c_token < num_tokens) {
if (command())
@@ -728,7 +728,7 @@
plot_token = 0; /* whole line to be saved as replot line */
screen_ok = FALSE;
- num_tokens = scanner(input_line);
+ num_tokens = scanner(&input_line, &input_line_len);
c_token = 1; /* skip the 'plot' part */
if (is_3d_plot)
plot3drequest();
@@ -1006,7 +1006,7 @@
else
(void) strcpy(prompt, "Help topic: ");
read_line(prompt);
- num_tokens = scanner(input_line);
+ num_tokens = scanner(&input_line, &input_line_len);
c_token = 0;
more_help = !(END_OF_COMMAND);
if (more_help)
--- docs/gnuplot.doc.ORIG Wed Oct 27 11:10:16 1999
+++ docs/gnuplot.doc Thu Dec 9 17:13:25 1999
@@ -1257,7 +1257,7 @@
blanks.
Command-line substitution can be used anywhere on the `gnuplot` command
- line.
+ line, except inside strings delimited by single quotes.
Example:
@@ -1267,6 +1267,11 @@
or, in VMS
f(x) = `run leastsq`
+
+ These will generate labels with the current time and userid:
+ set label "generated on `date +%Y-%m-%d`by `whoami`" at 1,1
+ set timestamp "generated on %Y-%m-%d by `whoami`"
+
2 Syntax
?syntax
?specify
--- protos.h.ORIG Fri Oct 1 11:37:23 1999
+++ protos.h Thu Dec 9 17:13:18 1999
@@ -224,7 +224,7 @@
/* Prototypes from file "scanner.c" */
-int scanner __PROTO((char expression[]));
+int scanner __PROTO((char **expression, int *line_lengthp));
/* Prototypes from "stdfn.c" */
--- scanner.c.ORIG Wed Nov 4 14:49:57 1998
+++ scanner.c Thu Dec 9 17:13:18 1999
@@ -37,7 +37,7 @@
#include "plot.h"
static int get_num __PROTO((char str[]));
-static void substitute __PROTO((char *str, int max));
+static void substitute __PROTO((char **strp, int *str_lenp, int current));
#ifdef AMIGA_AC_5
#define O_RDONLY 0
@@ -74,9 +74,10 @@
/*
* scanner() breaks expression[] into lexical units, storing them in token[].
- * The total number of tokens found is returned as the function value.
- * Scanning will stop when '\0' is found in expression[], or when token[]
- * is full.
+ * The total number of tokens found is returned as the function
+ * value. Scanning will stop when '\0' is found in expression[], or
+ * when token[] is full. extend_input_line() is called to extend
+ * expression array if needed.
*
* Scanning is performed by following rules:
*
@@ -95,13 +96,19 @@
* 5. !,<,> current char; also next if next is =
* 6. ", ' all chars up until matching quote
* 7. # this token cuts off scanning of the line (DFK).
+ * 8. ` (command substitution: all characters through the
+ * matching backtic are replaced by the output of
+ * the contained command, then scanning is restarted.)
*
* white space between tokens is ignored
*/
-int scanner(expression)
-char expression[];
+int
+scanner(expressionp, expressionlenp)
+char **expressionp;
+int *expressionlenp;
{
register int current; /* index of current char in expression[] */
+ char *expression = *expressionp;
register int quote;
char brace;
@@ -118,7 +125,8 @@
token[t_num].is_token = TRUE; /* to start with... */
if (expression[current] == '`') {
- substitute(&expression[current], MAX_LINE_LEN - current);
+ substitute(expressionp, expressionlenp, current);
+ expression = *expressionp; /* expression might have moved */
goto again;
}
/* allow _ to be the first character of an identifier */
@@ -165,6 +173,10 @@
&& expression[current + 1]) {
current++;
token[t_num].length += 2;
+ } else if (quote == '\"' && expression[current] == '`') {
+ substitute(expressionp, expressionlenp, current);
+ expression = *expressionp; /* it might have moved */
+ current--;
} else
token[t_num].length++;
}
@@ -267,10 +279,6 @@
#if defined(VMS) || defined(PIPES) || (defined(ATARI) || defined(MTOS)) && defined(__PUREC__)
-/* this really ought to make use of the dynamic-growth of the
- * input line in 3.6. And it definitely should not have
- * static arrays !
- */
/* A macro to reduce clutter ... */
# ifdef AMIGA_AC_5
# define CLOSE_FILE_OR_PIPE ((void) close(fd))
@@ -280,42 +288,58 @@
# define CLOSE_FILE_OR_PIPE ((void) pclose(f))
# endif
-static void substitute(str, max) /* substitute output from ` ` */
-char *str;
-int max;
+/* substitute output from ` `
+ * *strp points to the input string. (*strp)[current] is expected to
+ * be the initial back tic. Characters through the following back tic
+ * are replaced by the output of the command. extend_input_line()
+* is called to extend *strp array if needed.
+ */
+static void substitute(strp, str_lenp, current)
+char **strp;
+int *str_lenp;
+int current;
{
register char *last;
- register int i, c;
+ register int c;
register FILE *f;
# ifdef AMIGA_AC_5
int fd;
# elif (defined(ATARI) || defined(MTOS)) && defined(__PUREC__)
char *atari_tmpfile;
- char *atari_pgm[MAX_LINE_LEN+100];
# endif /* !AMIGA_AC_5 */
- static char pgm[MAX_LINE_LEN+1], output[MAX_LINE_LEN+1];
+ char *str, *pgm, *rest = NULL;
+ int pgm_len, rest_len;
# ifdef VMS
int chan, one = 1;
- static $DESCRIPTOR(pgmdsc, pgm);
+ struct dsc$descriptor_s pgmdsc = {0, DSC$K_DTYPE_T, DSC$K_CLASS_S, 0};
static $DESCRIPTOR(lognamedsc, MAILBOX);
# endif /* VMS */
/* forgive missing closing backquote at end of line */
- i = 0;
+ str = *strp + current;
last = str;
while (*++last) {
- if (*last == '`') {
- ++last; /* move past it */
+ if (*last == '`')
break;
+ }
+ pgm_len = last - str;
+ pgm = gp_alloc(pgm_len, "command string");
+ safe_strncpy(pgm, str + 1, pgm_len); /* omit ` to leave room for NUL */
+
+ /* save rest of line, if any */
+ if (*last) {
+ last++; /* advance past ` */
+ rest_len = strlen(last) + 1;
+ if (rest_len > 1) {
+ rest = gp_alloc(rest_len, "input line copy");
+ strcpy(rest, last);
}
- pgm[i++] = *last;
}
- pgm[i] = NUL; /* end with null */
- max -= strlen(last); /* max is now the max length of output sub. */
# ifdef VMS
- pgmdsc.dsc$w_length = i;
+ pgmdsc.dsc$a_pointer = pgm;
+ pgmdsc.dsc$w_length = pgm_len;
if (!((vaxc$errno = sys$crembx(0, &chan, 0, 0, 0, 0, &lognamedsc)) & 1))
os_error("sys$crembx failed", NO_CARET);
@@ -327,13 +351,11 @@
# elif (defined(ATARI) || defined(MTOS)) && defined(__PUREC__)
if (system(NULL) == 0)
os_error("no command shell", NO_CARET);
- if ((strlen(atari_tmpfile) + strlen(pgm) + 5) > MAX_LINE_LEN + 100)
- os_error("sorry, command to long", NO_CARET);
atari_tmpfile = tmpnam(NULL);
- strcpy(atari_pgm, pgm);
- strcat(atari_pgm, " >> ");
- strcat(atari_pgm, atari_tmpfile);
- system(atari_pgm);
+ gp_realloc(pgm, pgm_len + 5 + strlen(atari_tmpfile), "command string");
+ strcat(pgm, " >> ");
+ strcat(pgm, atari_tmpfile);
+ system(pgm);
if ((f = fopen(atari_tmpfile, "r")) == NULL)
# elif defined(AMIGA_AC_5)
if ((fd = open(pgm, "O_RDONLY")) == -1)
@@ -342,23 +364,36 @@
os_error("popen failed", NO_CARET);
# endif /* !VMS */
- i = 0;
- while ((c = getc(f)) != EOF) {
- output[i++] = ((c == '\n') ? ' ' : c); /* newlines become blanks */
- if (i == max) {
- CLOSE_FILE_OR_PIPE;
- int_error("substitution overflow", t_num);
- }
+ free(pgm);
+
+ /* now replace ` ` with output */
+ while (1) {
+# if defined(AMIGA_AC_5)
+ char ch;
+ if (read(fd, &ch, 1) != 1)
+ break;
+ c = ch;
+# else
+ if ((c = getc(f)) == EOF)
+ break;
+# endif /* !AMIGA_AC_5 */
+ /* newlines become blanks */
+ (*strp)[current++] = ((c == '\n') ? ' ' : c);
+ if (current == *str_lenp)
+ extend_input_line();
}
+ (*strp)[current] = 0;
CLOSE_FILE_OR_PIPE;
- if (i + strlen(last) > max)
- int_error("substitution overflowed rest of line", t_num);
/* tack on rest of line to output */
- safe_strncpy(output + i, last, MAX_LINE_LEN - i);
- /* now replace ` ` with output */
- safe_strncpy(str, output, max);
+ if (rest) {
+ while (current + rest_len > *str_lenp)
+ extend_input_line();
+ strcpy(*strp+current, rest);
+ free(rest);
+ }
+
screen_ok = FALSE;
}

View file

@ -0,0 +1,64 @@
# dynamic-contour-levels
--- plot.h.ORIG Tue Oct 19 14:32:17 1999
+++ plot.h Thu Dec 9 17:57:06 1999
@@ -131,7 +131,6 @@
#define LEVELS_AUTO 0 /* How contour levels are set */
#define LEVELS_INCREMENTAL 1 /* user specified start & incremnet */
#define LEVELS_DISCRETE 2 /* user specified discrete levels */
-#define MAX_DISCRETE_LEVELS 30
#define ANGLES_RADIANS 0
#define ANGLES_DEGREES 1
--- set.c.ORIG Thu Aug 19 15:36:35 1999
+++ set.c Thu Dec 9 17:57:06 1999
@@ -44,6 +44,7 @@
#include "stdfn.h"
#include "setshow.h"
#include "national.h"
+#include "alloc.h"
#define DEF_FORMAT "%g" /* default format for tic mark labels */
#define SIGNIF (0.01) /* less than one hundredth of a tic mark */
@@ -198,7 +199,8 @@
int contour_levels = 5;
double zero = ZERO; /* zero threshold, not 0! */
int levels_kind = LEVELS_AUTO;
-double levels_list[MAX_DISCRETE_LEVELS]; /* storage for z levels to draw contours at */
+double *levels_list; /* storage for z levels to draw contours at */
+int max_levels = 0; /* contour level capacity, before enlarging */
int dgrid3d_row_fineness = 10;
int dgrid3d_col_fineness = 10;
@@ -611,6 +613,10 @@
else if (almost_equals(c_token, MIN)) { AUTO |= 1; ++c_token; } \
else if (almost_equals(c_token, MAX)) { AUTO |= 2; ++c_token; }
+ if (max_levels == 0)
+ levels_list = (double *)gp_alloc((max_levels = 5)*sizeof(double),
+ "contour levels");
+
if (almost_equals(c_token, "ar$row")) {
c_token++;
set_arrow();
@@ -813,6 +819,10 @@
if (!equals(c_token, ","))
int_error("expecting comma to separate discrete levels", c_token);
c_token++;
+ if (i == max_levels)
+ levels_list = gp_realloc(levels_list,
+ (max_levels += 10)*sizeof(double),
+ "contour levels");
levels_list[i++] = real(const_express(&a));
}
contour_levels = i;
--- setshow.h.ORIG Sat Oct 3 21:17:47 1998
+++ setshow.h Thu Dec 9 17:57:06 1999
@@ -169,7 +169,7 @@
extern int contour_levels;
extern double zero; /* zero threshold, not 0! */
extern int levels_kind;
-extern double levels_list[MAX_DISCRETE_LEVELS];
+extern double *levels_list;
extern int dgrid3d_row_fineness;
extern int dgrid3d_col_fineness;

View file

@ -0,0 +1,74 @@
--- gplt_x11.c.ORIG Thu Dec 2 17:02:05 1999
+++ gplt_x11.c Thu Dec 2 17:02:54 1999
@@ -169,6 +169,10 @@
# define EINTR E_ILLFNC
#endif
+#ifdef __FreeBSD__
+# include <floatingpoint.h>
+#endif
+
/* information about one window/plot */
typedef struct plot_struct {
@@ -301,6 +305,10 @@
int argc;
char *argv[];
{
+#ifdef __FreeBSD__
+ /* allow divide by zero -- Inf */
+ fpsetmask(fpgetmask() & ~(FP_X_DZ | FP_X_INV));
+#endif
#ifndef X11ORG
setlocale(LC_ALL, "");
@@ -335,6 +343,12 @@
}
}
XCloseDisplay(dpy);
+
+#ifdef __FreeBSD__
+ fpresetsticky(FP_X_DZ | FP_X_INV);
+ fpsetmask(fpgetmask() | (FP_X_DZ | FP_X_INV));
+#endif
+
FPRINTF((stderr, "exiting\n"));
--- plot.c.ORIG Thu Dec 2 17:02:05 1999
+++ plot.c Thu Dec 2 17:02:54 1999
@@ -73,6 +73,10 @@
# endif
#endif /* _Windows */
+#ifdef __FreeBSD__
+# include <floatingpoint.h>
+#endif
+
extern FILE *gpoutfile;
TBOOLEAN interactive = TRUE; /* FALSE if stdin not a terminal */
@@ -347,6 +351,11 @@
_control87(MCW_EM, MCW_EM);
#endif
+#ifdef __FreeBSD__
+ /* allow divide by zero -- Inf */
+ fpsetmask(fpgetmask() & ~(FP_X_DZ | FP_X_INV));
+#endif
+
#if defined(OS2)
int rc;
if (_osmode == OS2_MODE) {
@@ -565,6 +574,11 @@
#ifdef OS2
if (_osmode == OS2_MODE)
RexxDeregisterSubcom("GNUPLOT", NULL);
+#endif
+
+#ifdef __FreeBSD__
+ fpresetsticky(FP_X_DZ | FP_X_INV);
+ fpsetmask(fpgetmask() | (FP_X_DZ | FP_X_INV));
#endif
#if defined(ATARI) || defined(MTOS)