On Sat, 2009-11-21 at 21:31 +0100, Øyvind Harboe wrote:
> Why is a table better than a fn call for registering commands?
It's harder to screw up with the new way of doing things, as the
registration parameters are more explicit. It also eliminates a lot of
redundant calls to register_command{,s} with a single call in tcl.c.
In short, it's more readable and produces slightly better binaries.
More importantly, the first patches in the previous series allowed the
registration parameters to be extended without disrupting the existing
registration callers. That series then added aded the 'usage' command,
and subsequent patches begin to split the help text out. Other
extensions will be much easier -- and can be done in stages -- by using
a table instead of a function.
For the target and flash, we'll need further patches to extend the
registration capabilities to allow "inheriting" commands. An arm966e
might register its own commands, but it also needs to register the
arm9tdmi, arm7_9_common, arm, and etm groups of commands as well.
I have these changes underway in my local tree, but each of my current
series offered reasonable milestones that showed the intended benefits.
There are some other minor features that need to be added to allow this
transformation to take place throughout the tree, but the result should
be a more openly transparent and extensible command handling system
(that eliminates redundancy when coding things up). Naturally, I'll
update the command API documentation in the manual once I am done with
these changes throughout the tree.
--Z
_______________________________________________
Openocd-development mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/openocd-development