On Saturday 04 June 2005 10:06 am, J=C3=BCrgen Wieferink wrote:
> Today I've searched the code for other occurances of
> 'free(...string_val)' and replaced them by 'gpfree_string'.
Great. I put that one in cvs.
> The third patch keeps track of backslashes within double quoted strings.
I had forgotten about this issue. I've put your fix into cvs
because it is better than the current state of affairs.=20
But I don't think this is the end of the story. I see it as=20
applying a bandaid to the deeper problem of extending the=20
distinction between single-quoted strings and double-quoted
string constants to string variables.
Currently the check for single- or double- quotes is made at
the time a string constant is parsed, as in:
A =3D "1\n2"
B =3D '1\n2'
if (A ne B) print "Strings are not equal"
But if you assign a value to a string variable via some more
complex path, including your new system() function, then there
is no check for whether embedded special characters should be
given the single-quote treatment (store raw input) or the
double-quote treatment (add \ in front of certain characters).
I don't have a specific example of when this would cause a
problem, but it makes me uneasy. I think it might be better to
remove the single/double quote processing from the parser, and
instead *always* store a string in its "raw" form, and add a
separate flag to indicate whether it is to be expanded or not
when printed.
>The second problem I found is revealed by:
> set macros
> foo =3D "print foo"
> @foo
> print "@foo"
> print "\"@foo\""
> print "\"@foo"; @foo
I haven't looked at this one yet, but there's another unresolved
issue as well, pointed out by Petr Mikulik a while back.
As you can see from the sequence below, it does not
work to define and invoke a macro on the same input line:
gnuplot> set macros
gnuplot> foo =3D "1"; print @foo; foo =3D "2"; print @foo
warning: foo is not a string variable
warning: foo is not a string variable
gnuplot> foo =3D "1"; print ; foo =3D "2"; print=20
^
constant expression required
gnuplot> show var
Variables:
pi =3D 3.14159265358979
foo =3D 1
gnuplot> foo =3D "2"; print @foo; foo =3D "3"; print @foo
1
1
=2D-=20
Ethan A Merritt merritt@u.washington.edu
Biomolecular Structure Center
Mailstop 357742
University of Washington, Seattle, WA 98195
|