Re: [GRASS-dev] [GRASS-SVN] r60703 - in grass/trunk: display/d.vect general/g.gisenv gui/wxpython/animation lib/python/temporal raster/r.colors raster/r.external raster/r.in.bin raster/r.mapcalc raste

2014-10-26 Thread Huidae Cho
This new API in libgis is backported in r62395, r62408, and r62411. On Wed, Sep 17, 2014 at 3:35 PM, Glynn Clements gl...@gclements.plus.com wrote: Anna Petrášová wrote: The parser syntax for Python scripts is not really documented anywhere, or am I missing something? AFAICT, the only

Re: [GRASS-dev] [GRASS-SVN] r60703 - in grass/trunk: display/d.vect general/g.gisenv gui/wxpython/animation lib/python/temporal raster/r.colors raster/r.external raster/r.in.bin raster/r.mapcalc raste

2014-09-17 Thread Glynn Clements
Anna Petrášová wrote: The parser syntax for Python scripts is not really documented anywhere, or am I missing something? AFAICT, the only documentation is in the form of examples in the g.parser manual, and the documentation of the C interface in the programming manual. -- Glynn Clements

Re: [GRASS-dev] [GRASS-SVN] r60703 - in grass/trunk: display/d.vect general/g.gisenv gui/wxpython/animation lib/python/temporal raster/r.colors raster/r.external raster/r.in.bin raster/r.mapcalc raste

2014-09-16 Thread Glynn Clements
Huidae Cho wrote: We also need to add option_rules or something to g.parser so that python scripts can have access to these functions. Something like: #%option_rules #% exclusive: -a, -b #% requires_all: opt1, opt2, -a #%end Done in r61994. -- Glynn Clements gl...@gclements.plus.com

Re: [GRASS-dev] [GRASS-SVN] r60703 - in grass/trunk: display/d.vect general/g.gisenv gui/wxpython/animation lib/python/temporal raster/r.colors raster/r.external raster/r.in.bin raster/r.mapcalc raste

2014-09-16 Thread Anna Petrášová
On Tue, Sep 16, 2014 at 8:07 AM, Glynn Clements gl...@gclements.plus.com wrote: Huidae Cho wrote: We also need to add option_rules or something to g.parser so that python scripts can have access to these functions. Something like: #%option_rules #% exclusive: -a, -b #%

Re: [GRASS-dev] [GRASS-SVN] r60703 - in grass/trunk: display/d.vect general/g.gisenv gui/wxpython/animation lib/python/temporal raster/r.colors raster/r.external raster/r.in.bin raster/r.mapcalc raste

2014-09-13 Thread Anna Petrášová
Hi, On Tue, Jul 22, 2014 at 2:58 PM, Huidae Cho gras...@gmail.com wrote: Hi, Well, there are no equivalent functions in python yet. Other than that, I think this new API is functionally satisfying and r.clump is using it. The patch looks good to me. BTW, I prefer option= and -f. could you

Re: [GRASS-dev] [GRASS-SVN] r60703 - in grass/trunk: display/d.vect general/g.gisenv gui/wxpython/animation lib/python/temporal raster/r.colors raster/r.external raster/r.in.bin raster/r.mapcalc raste

2014-07-22 Thread Anna Petrášová
On Wed, Jun 25, 2014 at 2:09 AM, Huidae Cho gras...@gmail.com wrote: We also need to add option_rules or something to g.parser so that python scripts can have access to these functions. Something like: #%option_rules #% exclusive: -a, -b #% requires_all: opt1, opt2, -a #%end On Fri,

Re: [GRASS-dev] [GRASS-SVN] r60703 - in grass/trunk: display/d.vect general/g.gisenv gui/wxpython/animation lib/python/temporal raster/r.colors raster/r.external raster/r.in.bin raster/r.mapcalc raste

2014-07-22 Thread Huidae Cho
Hi, Well, there are no equivalent functions in python yet. Other than that, I think this new API is functionally satisfying and r.clump is using it. The patch looks good to me. BTW, I prefer option= and -f. Regards, Huidae On Tue, Jul 22, 2014 at 1:53 PM, Anna Petrášová kratocha...@gmail.com

Re: [GRASS-dev] [GRASS-SVN] r60703 - in grass/trunk: display/d.vect general/g.gisenv gui/wxpython/animation lib/python/temporal raster/r.colors raster/r.external raster/r.in.bin raster/r.mapcalc raste

2014-07-22 Thread Glynn Clements
Anna Petrášová wrote: is this new API now stable enough to be actually used in C modules? Should we start to replace the manual checks in modules with these functions? I think so. I attached a patch which should fix this ticket [1]: when user doesn't type any command arguments and the

Re: [GRASS-dev] [GRASS-SVN] r60703 - in grass/trunk: display/d.vect general/g.gisenv gui/wxpython/animation lib/python/temporal raster/r.colors raster/r.external raster/r.in.bin raster/r.mapcalc raste

2014-07-22 Thread Michael Barton
If I understand this correctly, this will be very welcome! Thanks Michael __ C. Michael Barton Director, Center for Social Dynamics Complexity Professor of Anthropology, School of Human Evolution Social Change Head, Graduate Faculty in Complex Adaptive Systems

Re: [GRASS-dev] [GRASS-SVN] r60703 - in grass/trunk: display/d.vect general/g.gisenv gui/wxpython/animation lib/python/temporal raster/r.colors raster/r.external raster/r.in.bin raster/r.mapcalc raste

2014-06-25 Thread Huidae Cho
We also need to add option_rules or something to g.parser so that python scripts can have access to these functions. Something like: #%option_rules #% exclusive: -a, -b #% requires_all: opt1, opt2, -a #%end On Fri, Jun 20, 2014 at 9:59 PM, Huidae Cho gras...@gmail.com wrote:

Re: [GRASS-dev] [GRASS-SVN] r60703 - in grass/trunk: display/d.vect general/g.gisenv gui/wxpython/animation lib/python/temporal raster/r.colors raster/r.external raster/r.in.bin raster/r.mapcalc raste

2014-06-20 Thread Glynn Clements
Huidae Cho wrote: I assume G__check_option_rules() is supposed to be called by G_parser(). Then, instead of calling G_fatal_error, it should append errors to st-errors. Okay; I presume that the intent is so that it will report all errors, not just the first. If so... for g.mlist we can

Re: [GRASS-dev] [GRASS-SVN] r60703 - in grass/trunk: display/d.vect general/g.gisenv gui/wxpython/animation lib/python/temporal raster/r.colors raster/r.external raster/r.in.bin raster/r.mapcalc raste

2014-06-20 Thread Huidae Cho
G_option_excludes() works for me. On Fri, Jun 20, 2014 at 7:58 PM, Glynn Clements gl...@gclements.plus.com wrote: Huidae Cho wrote: I assume G__check_option_rules() is supposed to be called by G_parser(). Then, instead of calling G_fatal_error, it should append errors to st-errors.

Re: [GRASS-dev] [GRASS-SVN] r60703 - in grass/trunk: display/d.vect general/g.gisenv gui/wxpython/animation lib/python/temporal raster/r.colors raster/r.external raster/r.in.bin raster/r.mapcalc raste

2014-06-19 Thread Glynn Clements
Huidae Cho wrote: I think we need two more functions: // if the first option is present, all the other options must also be present. // same as multiple G_option_requires(first, opt)... void G_option_requires_all(void *first, ...); As you note, this can be

Re: [GRASS-dev] [GRASS-SVN] r60703 - in grass/trunk: display/d.vect general/g.gisenv gui/wxpython/animation lib/python/temporal raster/r.colors raster/r.external raster/r.in.bin raster/r.mapcalc raste

2014-06-19 Thread Glynn Clements
Glynn Clements wrote: I'll make a start on this. A first draft of the code has been added in r60871. Not tested yet. -- Glynn Clements gl...@gclements.plus.com ___ grass-dev mailing list grass-dev@lists.osgeo.org

Re: [GRASS-dev] [GRASS-SVN] r60703 - in grass/trunk: display/d.vect general/g.gisenv gui/wxpython/animation lib/python/temporal raster/r.colors raster/r.external raster/r.in.bin raster/r.mapcalc raste

2014-06-19 Thread Huidae Cho
Looks good to me. I'll try it with g.mlist/g.mremove later. On Thu, Jun 19, 2014 at 10:58 AM, Glynn Clements gl...@gclements.plus.com wrote: Glynn Clements wrote: I'll make a start on this. A first draft of the code has been added in r60871. Not tested yet. -- Glynn Clements

Re: [GRASS-dev] [GRASS-SVN] r60703 - in grass/trunk: display/d.vect general/g.gisenv gui/wxpython/animation lib/python/temporal raster/r.colors raster/r.external raster/r.in.bin raster/r.mapcalc raste

2014-06-19 Thread Huidae Cho
I assume G__check_option_rules() is supposed to be called by G_parser(). Then, instead of calling G_fatal_error, it should append errors to st-errors. If so... for g.mlist we can define two different versions of rules: This version prints more correct errors because only present options/flags

Re: [GRASS-dev] [GRASS-SVN] r60703 - in grass/trunk: display/d.vect general/g.gisenv gui/wxpython/animation lib/python/temporal raster/r.colors raster/r.external raster/r.in.bin raster/r.mapcalc raste

2014-06-18 Thread Huidae Cho
I think we need two more functions: // at most one option from a set void G_option_exclusive(void *first, ...); // at least one option from a set void G_option_required(void *first, ...); // if the first option is present, at least one of the other

Re: [GRASS-dev] [GRASS-SVN] r60703 - in grass/trunk: display/d.vect general/g.gisenv gui/wxpython/animation lib/python/temporal raster/r.colors raster/r.external raster/r.in.bin raster/r.mapcalc raste

2014-06-11 Thread Glynn Clements
Huidae Cho wrote: Maybe, we can use variadic macros in C99 to remove the first name argument. GRASS doesn't require C99. In general, we try to keep the hard dependencies to a bare minimium, particularly in core functionality such as libgis. In any case, the stdarg.h requirement for an

Re: [GRASS-dev] [GRASS-SVN] r60703 - in grass/trunk: display/d.vect general/g.gisenv gui/wxpython/animation lib/python/temporal raster/r.colors raster/r.external raster/r.in.bin raster/r.mapcalc raste

2014-06-11 Thread Huidae Cho
Right, G_option_exclusive(void *first, ...) should work. On Wed, Jun 11, 2014 at 6:43 AM, Glynn Clements gl...@gclements.plus.com wrote: Huidae Cho wrote: Maybe, we can use variadic macros in C99 to remove the first name argument. GRASS doesn't require C99. In general, we try to keep

Re: [GRASS-dev] [GRASS-SVN] r60703 - in grass/trunk: display/d.vect general/g.gisenv gui/wxpython/animation lib/python/temporal raster/r.colors raster/r.external raster/r.in.bin raster/r.mapcalc raste

2014-06-09 Thread Glynn Clements
Huidae Cho wrote: My implementation of the exclusive member, which you reverted, can handle all these cases, I think. But since you reverted it, I think you didn't agree with my interface or implementation? Not really. [I also wanted to be able to discuss this starting from a blank slate,

Re: [GRASS-dev] [GRASS-SVN] r60703 - in grass/trunk: display/d.vect general/g.gisenv gui/wxpython/animation lib/python/temporal raster/r.colors raster/r.external raster/r.in.bin raster/r.mapcalc raste

2014-06-09 Thread Huidae Cho
I somehow agree with you that my interface can be cryptic and requires some interpretation because information is spread out. I think we can define something like: // at most one option from a set void G_option_exclusive(const char *name, ...); // at least one option from

Re: [GRASS-dev] [GRASS-SVN] r60703 - in grass/trunk: display/d.vect general/g.gisenv gui/wxpython/animation lib/python/temporal raster/r.colors raster/r.external raster/r.in.bin raster/r.mapcalc raste

2014-06-09 Thread Huidae Cho
Maybe, we can use variadic macros in C99 to remove the first name argument. #define G_option_exclusive(...) G__option_exclusive(NULL, __VA_ARGS__) On Mon, Jun 9, 2014 at 10:54 AM, Huidae Cho gras...@gmail.com wrote: I somehow agree with you that my interface can be cryptic and requires some

Re: [GRASS-dev] [GRASS-SVN] r60703 - in grass/trunk: display/d.vect general/g.gisenv gui/wxpython/animation lib/python/temporal raster/r.colors raster/r.external raster/r.in.bin raster/r.mapcalc raste

2014-06-09 Thread Huidae Cho
Interesting, actually this works better I think. #define G_option_exclusive(...) G__option_exclusive(NULL, __VA_ARGS__, NULL) G_option_exclusive(opt1, opt2, flag1); // no need for the first name and last NULL arguments. On Mon, Jun 9, 2014 at 11:13 AM, Huidae Cho gras...@gmail.com wrote:

Re: [GRASS-dev] [GRASS-SVN] r60703 - in grass/trunk: display/d.vect general/g.gisenv gui/wxpython/animation lib/python/temporal raster/r.colors raster/r.external raster/r.in.bin raster/r.mapcalc raste

2014-06-09 Thread Vaclav Petras
On Mon, Jun 9, 2014 at 11:16 AM, Huidae Cho gras...@gmail.com wrote: Interesting, actually this works better I think. #define G_option_exclusive(...) G__option_exclusive(NULL, __VA_ARGS__, NULL) G_option_exclusive(opt1, opt2, flag1); // no need for the first name and last NULL arguments.

Re: [GRASS-dev] [GRASS-SVN] r60703 - in grass/trunk: display/d.vect general/g.gisenv gui/wxpython/animation lib/python/temporal raster/r.colors raster/r.external raster/r.in.bin raster/r.mapcalc raste

2014-06-08 Thread Huidae Cho
My implementation of the exclusive member, which you reverted, can handle all these cases, I think. But since you reverted it, I think you didn't agree with my interface or implementation? IMO, passing option/flag names to G_option_required() has its own disadvantage because changing option/flag

Re: [GRASS-dev] [GRASS-SVN] r60703 - in grass/trunk: display/d.vect general/g.gisenv gui/wxpython/animation lib/python/temporal raster/r.colors raster/r.external raster/r.in.bin raster/r.mapcalc raste

2014-06-06 Thread Glynn Clements
Huidae Cho wrote: I was thinking about the same thing. Maybe add char *exclusive_group to Option and Flag and G_parser() takes care of exclusiveness? There are two relatively straightforward cases for option interdependencies: 1. At most one option from a set may be provided (mutual

Re: [GRASS-dev] [GRASS-SVN] r60703 - in grass/trunk: display/d.vect general/g.gisenv gui/wxpython/animation lib/python/temporal raster/r.colors raster/r.external raster/r.in.bin raster/r.mapcalc raste

2014-06-04 Thread Martin Landa
Hi, 2014-06-04 19:17 GMT+02:00 svn_gr...@osgeo.org: 1. Consolite option/flag mutually exslusive messages. it would be nice to solve it in the parser level... Martin -- Martin Landa * http://geo.fsv.cvut.cz/gwiki/Landa ___ grass-dev mailing list

Re: [GRASS-dev] [GRASS-SVN] r60703 - in grass/trunk: display/d.vect general/g.gisenv gui/wxpython/animation lib/python/temporal raster/r.colors raster/r.external raster/r.in.bin raster/r.mapcalc raste

2014-06-04 Thread Huidae Cho
I was thinking about the same thing. Maybe add char *exclusive_group to Option and Flag and G_parser() takes care of exclusiveness? On Wed, Jun 4, 2014 at 2:03 PM, Martin Landa landa.mar...@gmail.com wrote: Hi, 2014-06-04 19:17 GMT+02:00 svn_gr...@osgeo.org: 1. Consolite option/flag