On Thursday 31 July 2008, Ethan A Merritt wrote:
> On Thursday 31 July 2008, Shigeharu TAKENO wrote:
> > shige 08/01 2008
> > ----------------
> >
> > The gnuplot of current CVS version may make core dump by the
> > following script which includes the lack data of xticlabels(),
> > but gnuplot-4.2.3 may not:
> >
> > plot '-' using 1:2:xtic(3) w l
> > 1 2 tic1
> > 2 3 tic2
> > 3 6
> > 4 4 tic4
> > 5 5 tic5
> > e
>
> Thank you for the bug report.
>
> Rather than storing a NULL label and having to test for NULL every time
> the list of labels is scanned, I think it would be better not to store a
> NULL label at all.
Now I see there is a difference in the two fixes.
One way writes a tic mark even if there is no label;
the other way writes neither a tic mark nor a label.
Normally I'd say that the user could catch the missing label and replace
it with "" if they wanted a tic mark. But unfortunately you can't trap the
missing tic label from the command line.
gnuplot> plot 'xtic.dat' using 1:2:xtic(strcol(3)?strcol(3):"")
non-integer passed to boolean operator
various other attempts at this cause various other error messages.
So it seems we have to choose either no tic, or a tic but no label.
I don't know which is likely to please more users.
[or I suppose we could teach the boolean operators that a NULL string
is to be treated as FALSE].
Ethan
> Something like this (not tested thorougly, but seems foolproof):
>
> --- ../../gnuplot/src/axis.c 2008-06-05 21:15:58.000000000 -0700
> +++ ./axis.c 2008-07-31 21:39:09.000000000 -0700
> @@ -1618,6 +1618,9 @@ add_tic_user(AXIS_INDEX axis, char *label
> struct ticmark *tic, *newtic;
> struct ticmark listhead;
>
> + if (!label)
> + return;
> +
> /* Mark this axis as user-generated ticmarks only, unless the */
> /* mix flag indicates that both user- and auto- tics are OK. */
> if (!axis_array[axis].ticdef.def.mix)
>
>
>
>
> > OS: Solaris 9 (sparc)
> > compiler: gcc-3.4.3
> >
> > The following patch seems to fix it.
> >
> > ----- From here -----
> > --- axis.c.ORG Fri Aug 1 12:20:48 2008
> > +++ axis.c Fri Aug 1 13:03:09 2008
> > @@ -872,8 +872,12 @@
> > if (!inrange(internal, internal_min, internal_max))
> > continue;
> >
> > - if (mark->level < 0) /* label read from data file */
> > - strncpy(label, mark->label, sizeof(label));
> > + if (mark->level < 0) {/* label read from data file */
> > + if (mark->label != NULL)
> > + strncpy(label, mark->label, sizeof(label));
> > + else
> > + label[0]='\0';
> > + }
> > else if (axis_array[axis].is_timedata)
> > gstrftime(label, 24, mark->label ? mark->label : ticfmt[axis], mark->position);
> > else
> > ----- To here -----
> >
> > +========================================================+
> > Shigeharu TAKENO NIigata Institute of Technology
> > kashiwazaki,Niigata 945-1195 JAPAN
> > shige@... TEL(&FAX): +81-257-22-8161
> > +========================================================+
> >
--
Ethan A Merritt
|