Overview
| Artifact ID: | 9fd5908d3a19dca21d5bf01835b566e2aeeb614b |
|---|---|
| Ticket: | 1446696fffffffffffffffffffffffffffffffff
Tcl_ParseArgv as a useful non-Tk version of Tk_ParseArgv |
| User & Date: | sbromle on 2006-06-15 05:45:08 |
Changes
- icomment:
Logged In: YES user_id=1472195 Yep. Naviserver's tclobjv.c seems to provide similar functionality, without the need to make a local copy of the objects. It gets around this by parsing both options and arguments in the call, whereas the tclArgv version (based on TkArgv.c) parses only the options, and repacks the array leaving only arguments and unknown options. This ability to leave unknown arguments and options on the objv array is useful when one wants to strip different options with different functions (though I admit, I haven't needed to do so myself as of yet.) From a usability perspective I'm sure both approaches are valid. I have a few questions that could help bring me up to speed on the naviserver version: (i) Does the order of options matter? (ii) Can options be interspersed with arguments? (iii) What happens in the case of unknown arguments? (iv) Is there an automatically generated help? (v) Do all arguments have to be known in advance? Equivalently, can the number of arguments be dynamic, depending on, say, the value of options? (tclArgv allows this as the arguments are just repackaged for subsequent parsing by the caller). My bias (at least in terms of for inclusion into Tcl proper) is that the function be as stand-alone and as simple as possible. In this sense, the tclArgv.c file below might be seen as a more closed-form solution than the tclobjv.c version with its additional typedefs and subfunctions. Moreover, tclArgv.[hc] are the only two files needed to add this functionality to any project (which we use quite cleanly now compiled up as a shared library). Perhaps the naviserver tclobjv could be easily simplified as well. I welcome comments on these points. Should tclArgv.c be deemed sufficiently useful for consideration for inclusion into Tcl proper, I'd be happy to recode a GetIndexFromObject version of tclArgv.c if this is a sticking point.
- login: "sbromle"
- mimetype: "text/plain"
- username: "sbromle"