[Changeset]: Re: Again error with graphics.h
David Bateman
adb014 at gmail.com
Wed May 28 15:11:18 CDT 2008
David Bateman wrote:
> David Bateman wrote:
>
>> In fact the change is fairly easy, just replace
>>
>> dval = gensub (/^.*\{(.*)\}.*$/, "\"\\1\"", "g", dval);
>>
>> with
>>
>> gsub (^.*\{(.*)\}.*$/, "\"\\1\"", dval);
>>
>> at line 413 and
>>
>> class_name = gensub (/^.*BEGIN_PROPERTIES\((.*)\)/, "\\1", "g");
>>
>> with
>>
>> class_name = $0;
>> gsub (/^.*BEGIN_PROPERTIES\((.*)\)/, "\\1", class_name);
>>
>> at line 439. I believe gsub is compatible with awk.
>>
>> D.
>
> and here is this change as a mercurial changeset
>
Humm, ok forget this changeset.. It appears that the gensub actually has
a feature not in gsub. Quoting the gawk manual
<quote>
gensub provides an additional feature that is not available in sub or
gsub: the ability to specify components of a regexp in the replacement
text. This is done by using parentheses in the regexp to mark the
components and then specifying `\N' in the replacement text, where N is
a digit from 1 to 9. For example:
$ gawk '
> BEGIN {
> a = "abc def"
> b = gensub(/(.+) (.+)/, "\\2 \\1", "g", a)
> print b
> }'
-| def abc
</quote>
and this feature is used... Ok its therefore not obvious how to get rid
of the gawk specific code.
D.
More information about the Help-octave
mailing list