[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Changeset]: Re: Again error with graphics.h
From: |
David Bateman |
Subject: |
Re: [Changeset]: Re: Again error with graphics.h |
Date: |
Wed, 28 May 2008 22:11:18 +0200 |
User-agent: |
Thunderbird 2.0.0.12 (X11/20080306) |
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.