entropyreduction wrote:
> See
>
> http://www.cmcrossroads.com/bradapp/ftp/src/libs/C++/CmdLine.html
> http://www.cmcrossroads.com/bradapp/ftp/src/libs/C++/Options.html
>
> to see if what's done there covers what you want to do.
Hi,
I want to be able to call powerpro scripts the same way I call C
programs or sh scripts, that is intermixing unix-style long/short
options, and printing a usage message on syntax errors.
Examples:
(from a script file) Do(".script","-x 1 --longoption=yes")
(from cli) c:\> ppbang .script("--longoption=yes -x1")
The stuff that is covered in the links you mention is very powerful and
certainly can support option parsing, but I have no idea of how to use
C++ classes from PowerPro. Whatever the solution, it has to conform to
ordinary PowerPro idioms. For instance, suppose that there was a new
Options plugin, then I'd expect to use it more or less like this
local opts=map.create(11) ;; max 10 options + usage string
local syntax="-x{num} --longoption{string}" ;; see NOTE below
local args=""
local i
; concatenate arg() vector
for(i=1; arg(i) && i<=8; i=i+1)
args=args++" "++arg(i)
endfor
; parse script arguments
local error = Options.syntax(opts, syntax, args)
; on error print usage message and quit
if(error)do
for(i=word(opts["USAGE"]; i>0; i=i-1)do
win.debug(word(opts["USAGE"],i)
quit(-1)
endif
; process options
if(opts["x"])do
win.debug("-x", opts["x"], "was specified")
; etc.
endif
; etc.
NOTE: I oversimplified my syntax definition lines. In reality, I'd like
to see the same kind of flexibility that those C++ parsing classes
offer, with ways to define the alternative short and long form for the
same option, and a standard way to retrieve its value as indexed by the
short-form option label.
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Yahoo! Domains - Claim yours for only $14.70
http://us.click.yahoo.com/Z1wmxD/DREIAA/yQLSAA/JV_rlB/TM
---------------------------------------------------------------------~->
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/power-pro/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/