[GRASS-dev] GRASS7 wish
Glynn Clements
glynn at gclements.plus.com
Fri Jun 16 06:07:14 EDT 2006
David Finlayson wrote:
> > > As part of my Pythonification of grass project, I'd like to add to our
> > > GRASS 7 workload:
> > >
> > > Would it be useful to have metadata about our scripts and programs?
> > > Basically, what I propose is a simple text file that describes each
> > > command and script in a standard format. I like the format that
> > > g.parser uses in sh scripts today. I would extend it to include a
> > > short help and long help description and a sort-of 'magic cookie'
> > > which describes how to launch the script/program.
> > >
> > > g.parser would be adjusted to read the resource file so there would be
> > > no user-visible changes. HTML documentation would be built using the
> > > resource file and an HTML template. GUI's could build their GUI code
> > > based on the resource file.
> >
> > If you need more information about a module, extend the Module, Flag,
> > or Option structures to contain the relevant information, and update
> > the relevant functions in lib/gis/parser.c to use that information.
> >
> > Having separate metadata files creates a risk of those files getting
> > out of sync with the actual modules.
>
> I think we misunderstood each other. What I want is a simple method
> for a grass program to describe itself to ANOTHER program.
>
> Ideally, the user-interface (whether GUI or Text) of each binary and
> script would be built by parsing the resource file for input and
> output requirements (flags, etc.). Also, the console help and HTML
> manual pages would be built directly from the resource file.
Are you proposing generating the code for the
G_define_{module,flag,option} calls from a text file?
Apart from being a lot of work to convert all of the modules, working
with machine-generated code is frequently a pain. And you still have
to include some per-flag/option code to associate each option with a
specific variable. IOW, if you want to add, remove or change an
option, you have to modify both the description file and main.c,
rather than just main.c.
I don't see any advantage to storing the description in an external
file compared to including it in the module/flag/option description
and having G_parser() generate the external representation for
situations which require it (as we already do for the HTML manual
pages and the Tcl/Tk GUI).
--
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-dev
mailing list