Re: support for built-in -opt style options for proc

Liste des GroupesRevenir à cl tcl 
Sujet : Re: support for built-in -opt style options for proc
De : rich (at) *nospam* example.invalid (Rich)
Groupes : comp.lang.tcl
Date : 25. Jun 2024, 17:20:35
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v5eqoj$1kk24$1@dont-email.me>
References : 1 2 3 4
User-Agent : tin/2.6.1-20211226 ("Convalmore") (Linux/5.15.139 (x86_64))
et99 <et99@rocketship1.me> wrote:
On 6/25/2024 12:01 AM, Mark Summerfield wrote:
I had peeked at that but was put off by there being no 'examples'
section.  I'll have another look at it.
 
Thanks also to the other repliers, but I want something 'standards'
rather than ad hoc.  I do find it surprising that it isn't part of
Tcl itself.
 
 
I too looked at tepam and also TIP 457 but found both to be
impenetrable without some serious study, of which I was not motivated
to expend.  Maybe if Ashok were to write a chapter with his ability
to simplify esp.  with good examples.
 
However, it seems to me that a somewhat simple solution for a
"standard" might be a proc say, called processArgs and hand it an
argument spec similar to what was given in the first posting, then it
could parse the spec, in the manner of say, YACC with a bnf spec. 
Using [uplevel] it could create variables in the proc.

There is also, in tcllib, the 'cmdline' package:

https://core.tcl-lang.org/tcllib/doc/trunk/embedded/md/tcllib/files/modules/cmdline/cmdline.md

Which provides an options parser that is very similar (although not
100% identical) to the GNU C 'getopt' options parser.  And the man page
has an example.

Quite a number of other tcllib modules use 'cmdline' for their options
parsing, so it is 'reasonably standard' in that sense -- and being very
similar to the gnulib C 'getopt' library function makes it much more
'standards like' (assuming one considers C library functions to be
'standard') than most.


Date Sujet#  Auteur
24 Jun 24 * support for built-in -opt style options for proc21Mark Summerfield
24 Jun 24 +* Re: support for built-in -opt style options for proc3et99
24 Jun 24 i`* Re: support for built-in -opt style options for proc2et99
24 Jun 24 i `- Re: support for built-in -opt style options for proc1et99
25 Jun 24 +- Re: support for built-in -opt style options for proc1Scott Pitcher
25 Jun 24 +* Re: support for built-in -opt style options for proc6Christian Gollwitzer
25 Jun 24 i+- Re: support for built-in -opt style options for proc1Harald Oehlmann
25 Jun 24 i`* Re: support for built-in -opt style options for proc4Harald Oehlmann
25 Jun 24 i `* Re: support for built-in -opt style options for proc3Mark Summerfield
25 Jun 24 i  +- Re: support for built-in -opt style options for proc1Harald Oehlmann
27 Jun 24 i  `- Re: support for built-in -opt style options for proc1Andreas Leitgeb
25 Jun 24 `* Re: support for built-in -opt style options for proc10Mark Summerfield
25 Jun 24  +- Re: support for built-in -opt style options for proc1Harald Oehlmann
25 Jun 24  `* Re: support for built-in -opt style options for proc8et99
25 Jun 24   `* Re: support for built-in -opt style options for proc7Rich
25 Jun 24    +* Re: support for built-in -opt style options for proc3et99
25 Jun 24    i+- Re: support for built-in -opt style options for proc1ted@loft.tnolan.com (Ted Nolan
25 Jun 24    i`- Re: support for built-in -opt style options for proc1Rich
26 Jun 24    `* Re: support for built-in -opt style options for proc3Mark Summerfield
26 Jun 24     `* Re: support for built-in -opt style options for proc2Rich
27 Jun 24      `- Re: support for built-in -opt style options for proc1Mark Summerfield

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal