[GRASS-dev] [grass.script.core] parser() casts options as strings

Martin Landa landa.martin at gmail.com
Fri Jul 31 04:24:22 EDT 2009


Hi,

2009/7/29 Glynn Clements <glynn at gclements.plus.com>:
> The ->answer field in "struct Option" is a char*; it can only hold a
> string. Similarly, that's all that g.parser can pass to a script. It's
> up to the module or script to parse these to integers or floats where
> appropriate.

would make sense to change it in GRASS 7, e.g. option->answer as
'union' (int, double, char *). In this regard also check given value
by the parser. Then the parser could print a warning when the user
enter option value which cannot be casted to the given data type (e.g.
string for integer option).

Martin

-- 
Martin Landa <landa.martin gmail.com> * http://gama.fsv.cvut.cz/~landa


More information about the grass-dev mailing list