[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: mercurial in OS 10.4.11 (was imread/imwrite)
From: |
Jaroslav Hajek |
Subject: |
Re: mercurial in OS 10.4.11 (was imread/imwrite) |
Date: |
Fri, 20 Jun 2008 23:41:01 +0200 |
On Fri, Jun 20, 2008 at 10:28 PM, John W. Eaton <address@hidden> wrote:
> On 20-Jun-2008, Jaroslav Hajek wrote:
>
> | On Fri, Jun 20, 2008 at 9:49 AM, David Bateman
> | <address@hidden> wrote:
> | > Thomas L. Scofield wrote:
> | >>
> | >> I've been using some scripts that Ben Abbott supplied me with. The
> | >> main script is
> | >>
> | >> cd ~/devel/mercurial/octave
> | >> hg update -C default
> | >> cd ..
> | >> if [ -d "octave-3.0.0" ]; then
> | >> rm -r octave-3.0.0
> | >> fi
> | >> if [ -f "octave-3.0.0.tar.gz" ]; then
> | >> rm octave-3.0.0.tar.gz
> | >> fi
> | >> cp -r octave octave-3.0.0
> | >> cd octave-3.0.0
> | >> ../osx_fix.sh
> | >> ./autogen.sh
> | >> cd ..
> | >> tar cvzf octave-3.0.0.tar.gz octave-3.0.0
> | >> md5 octave-3.0.0.tar.gz
> | >> echo "(1) Add md5 to octave.info"
> | >> mate "/sw/fink/10.4/local/main/finkinfo/sci/octave.info"
> | >> sudo cp octave-3.0.0.tar.gz /sw/src/.
> | >> sudo fink rebuild octave
> | >> sudo fink remove octave
> | >> sudo fink install octave
> | >>
> | >>
> | >> while the osx_fix.sh script does as he describes in this note to
> | >> Maintainers
> | >>
> | >>
> http://www.cae.wisc.edu/pipermail/octave-maintainers/2008-April/006941.html
> | >>
> | >>
> | >> Things progress along quite well for some time into the "make"
> | >> process. Here are the last few lines of output:
> | >>
> | >> make -C src all
> | >> making DASPK-opts.cc from ../liboctave/DASPK-opts.in
> | >> making DASRT-opts.cc from ../liboctave/DASRT-opts.in
> | >> making DASSL-opts.cc from ../liboctave/DASSL-opts.in
> | >> making LSODE-opts.cc from ../liboctave/LSODE-opts.in
> | >> making NLEqn-opts.cc from ../liboctave/NLEqn-opts.in
> | >> making Quad-opts.cc from ../liboctave/Quad-opts.in
> | >> making defaults.h from defaults.h.in
> | >> making graphics.h
> | >> awk: syntax error at source line 413 in function emit_source source
> | >> file ./genprops.awk
> | >> context is
> | >> dval = gensub >>> (/^.*\{(.*)\}.*$/, <<< "\"\\1\"",
> | >> "g", dval);
> | >> awk: illegal statement at source line 414 in function emit_source
> | >> source file ./genprops.awk
> | >> awk: syntax error at source line 439 source file ./genprops.awk
> | >> make[2]: *** [graphics.h] Error 2
> | >> make[1]: *** [src] Error 2
> | >> make: *** [all] Error 2
> | >> ### execution of /var/tmp/tmp.2.W8ECNr failed, exit code 2
> | >
> | > You need "gawk" and not "awk" to be used.. Unfortunately the
> | > genprops.awk script uses a "gawk"-ism and there is no obvious way to
> | > remove. However, I'd be all for making genprops.awk vanilla awk
> | > compatible if possible.
> | >
> | > http://www.nabble.com/Again-error-with-graphics.h-to17487289.html
> | >
> | > where its explained the issue is related to the gensub versus gsub
> | > functions in gawk.
> | >
> |
> |
> | I believe the attached patch could work, because match should be POSIX
> | with all features included. Thomas, can you test it or tell me what
> | awk you have?
> | I'll try downloading some other awks to test this.
>
> | diff --git a/src/genprops.awk b/src/genprops.awk
> | --- a/src/genprops.awk
> | +++ b/src/genprops.awk
> | @@ -465,9 +465,11 @@
> | {
> | dval = defval[i];
> | if (type[i] == "radio_property" || type[i] == "color_property")
> | - dval = gensub (/^.*\{(.*)\}.*$/, "\"\\1\"", "g", dval);
> | - if (! dval)
> | - dval = "octave_value ()";
> | + if (match (dval, /^.*\{(.*)\}.*$/, res))
> | + dval = "\"" + res[1] + "\"";
> | + else
> | + dval = "octave_value ()";
> | +
> | printf (" m[\"%s\"] = %s%s;\n", name[i], dval,
> | (type[i] == "handle_property" ? ".as_octave_value ()" : ""))
> >> filename;
> | }
>
> The AWK book only documents a two-argument version of match, but notes
> that it sets RSTART and RLENGTH. I see that mawk fails for this:
>
> echo "foo bar baz" | mawk '{match ($0, /^foo ([^ ]*)/, res); print res[1]; }'
> mawk: line 1: syntax error at or near ,
>
> The following doesn't fail, but it doesn't really do the right thing
> either:
>
> echo "foo bar baz" | gawk '{match ($0, /^foo ([^ ]*)/); print RSTART,
> RLENGTH; }'
> 1 7
>
> Note RSTART and RLENGTH cover the entire regexp, not just the part in
> parens. So I guess something else is needed if you want this to be
> portable.
>
> jwe
>
Okay, so what about the following? It's the "good old way", using only
index and substr.
This should definitely be POSIX compatible...
--
RNDr. Jaroslav Hajek
computing expert
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz
genprops.awk.diff
Description: Text Data
- imread/imwrite, Thomas L. Scofield, 2008/06/19
- Re: imread/imwrite, Julian Schnidder, 2008/06/19
- mercurial in OS 10.4.11 (was imread/imwrite), Thomas L. Scofield, 2008/06/19
- Re: mercurial in OS 10.4.11 (was imread/imwrite), David Bateman, 2008/06/20
- Re: mercurial in OS 10.4.11 (was imread/imwrite), Jaroslav Hajek, 2008/06/20
- Re: mercurial in OS 10.4.11 (was imread/imwrite), John W. Eaton, 2008/06/20
- Re: mercurial in OS 10.4.11 (was imread/imwrite),
Jaroslav Hajek <=
- Re: mercurial in OS 10.4.11 (was imread/imwrite), dbateman, 2008/06/20
- Re: mercurial in OS 10.4.11 (was imread/imwrite), Jaroslav Hajek, 2008/06/21
- Re: mercurial in OS 10.4.11 (was imread/imwrite), John W. Eaton, 2008/06/23
Re: imread/imwrite, Ben Abbott, 2008/06/20
imread/imwrite, John W. Eaton, 2008/06/20