[GRASS-dev] TclTk animator finished - replaces xganim

Glynn Clements glynn at gclements.plus.com
Fri Sep 14 14:08:45 EDT 2007


Michael Barton wrote:

> >> Thanks for clarifying this. It isn't described anywhere in the xganim docs,
> >> so I was unable to get it to animate more than a few maps.
> >> 
> >> The parsing in the new TclTk module is still simpler. It will correctly
> >> recognize rast[1-100].
> > 
> > That's an odd definition of "correct". Users are likely to expect
> > [...] to follow glob/regexp semantics (match a single character from
> > the set), so "rast[1-100]" should be equivalent to "rast[01]".
> 
> Command line Linux users and programmers who use glob/regexp semantics might
> well expect this.

As will anyone familiar with xganim.

> Non-programmer users, especially of non-Linux platforms
> probably will understand [1-100] as meaning from 1 to 100.

They won't be expecting [...] to mean anything.

> In either case,
> it needs to go into the docs so that a user will know how to specify maps
> that end in 1 to 100
> 
> [1-100] or [1-9][0-9][0]
> 
> The latter is harder to explain in docs than the former to someone not
> familiar with regexp--and even some of us familiar with it.

If you want to provide a convenient mechanism for numbered sequences,
use a different syntax; don't use glob/regexp/xganim syntax then
interpret it differently.

> > I suggest that this is fixed sooner rather than later.
> 
> The way it was, it had BASH commands (i.e., grep) to parse the output of
> g.list, followed by a TclTk string match to find the maps that matched the
> [n-n] pattern. I tried to use the matches as a validation routine, using
> pure TclTk parsing, but was unable to get reliable matches and decided that
> I probably didn't need to validate at that point because an invalid map
> would be caught later.
> 
> I'm not convinced that a regexp syntax is easier for users to deal with.

Users will need to know either regexp or glob syntax to make use of
e.g. "g.mlist ... pat=..." (and thus g.mremove, maybe others). And you
can't get very far on Linux without learning to use either or both of
glob and regexp syntax.

> But
> maybe it would be potentially less confusing to programmers if parentheses
> instead of brackets were used. rast(1-100) instead of rast[1-100]?

Yes. Also, any "sequence" patterns need to handle names with or
without leading zeros (i.e. both rast(001-100) and rast(1-100)). If
you have a choice, you're probably going to prefer to use leading
zeros so that map names sort correctly.

> Will the regexp pattern match syntax permit the use of * and correctly
> handle maps whose number suffixes are padded with leading 0's? Or does it
> just handle the bracketed character ranges?

Both regexp and glob syntax treat [...] as meaning a single character
from the specified set.

With regexps, you can then apply operators (i.e. *, +, ?, {n,m}) if
you want to match a variable number of those characters.

glob patterns are "flat", i.e. there are no operators which can be
applied to existing expressions to construct more complex expressions. 
E.g. if you want to match a three-digit number, you need to use
[0-9][0-9][0-9].

-- 
Glynn Clements <glynn at gclements.plus.com>




More information about the grass-dev mailing list