Bernhard Schmalhofer <[EMAIL PROTECTED]> wrote: > Hi, > for Parrot m4, I have started on a parser for command line options. > The idea is to port the Perl5 module Getopt::Long to PIR. Right now > it handles only long options and the interface is still pretty nasty.
> As it might be useful for other programs, I have prepared the two files: > i. runtime/parrot/include/Getopt_Long.imc is the module > ii. examples/assembly/getopt_demo.imc is a demo program Fine, fine. Some remarks: ad getopt_demo: .pcc_sub _main prototyped .param var argv .sym int argc argc = argv ... .sym var options options = new PerlArray push options, "version" $P0 = new Boolean # should be 0 already push options, $P0 ... Copy the array is just newarray = clone argv ad Getopt_Long It should use PCC style subroutines. Error messages should go to stderr. IMHO it could return the result hash, so that the caller then can do: defined ok, result["version"] str = result["string"] I think you could just pass in the array with Getopt::Long like specifiers (string=s ...). Should I check it in or do you like to cleanup first? > I'm planning on using pcre. Not everybody might have pcre, so if its not really needed rather not. leo