[Chicken-users] r6rs-bytevectors for chicken 5
With his permission, I've turned John Cowan's r6rs-bytevectors implementation: https://github.com/scheme-requests-for-implementation/srfi-4/tree/master/contrib/cowan into a Chicken 5 egg here: https://github.com/dieggsy/r6rs-bytevectors I'm aware of the separate C4 implementation of r6rs-bytevectors. I originally tried to port that implementation to C5, but I had some trouble with that and I think John's implementation is a little more favorable for a couple reasons: - It's a little more recent and pretty much already written in C5 syntax - my changes were fairly minimal and trivial. - It implements a couple flonum operations in C - It has fairly extensive tests, which I've converted to use the test egg. It'd be nice to have this in the egg repo for Chicken 5, assuming I haven't made any glaring mistakes. - Diego A. Mundo ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Bug with #:optional in args egg?
Vasilij, Thanks for your reply. While I find it a bit odd that someone might want the args behavior the way it is (I guess it seems less versatile to me), I've explored getopts-long per your recommendation and I think I even like it more. My only current gripe with getopts-long is that it doesn't seem to support passing values to long options with a space instead of an "=" (even though one of th examples provided says otherwise, the "--apples" "Granny Smith" bit). Diego Original Message Subject: Re: [Chicken-users] Bug with #:optional in args egg? Local Time: June 20, 2017 1:17 AM UTC Time: June 20, 2017 5:17 AM From: v.schneiderm...@gmail.com To: Diego A. Mundo <diegoamu...@protonmail.com> chicken-users@nongnu.org <chicken-users@nongnu.org> Hello Diego, I"m not sure whether this is a bug and fixing it is desired. If changed, it would affect existing programs using the args egg that would no longer work in the old way. Also, there are programs that do argument parsing this way, albeit not many and typically only for a few select arguments, like mysql for passwords (typing a space between -p and the argument made the password check fail) and compilers (for -L and alike). I"ve switched to the getopt-long egg for this reason. While it doesn"t do as much magic and takes more effort to understand, the command line interfaces created with it feel completely like proper GNU programs. Cheers Vasilij___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] Bug with #:optional in args egg?
With the example on the args eggref (http://wiki.call-cc.org/eggref/4/args#examples) slightly modified to this: #!/usr/local/bin/csi -script (use args) (define opts (list (args:make-option (c cookie) #:none "give me cookie" (print "cookie was tasty")) (args:make-option (d depth) #:optional "debug level [default: 1]" (print "depth: arg is " arg)) (args:make-option (e elephant) #:required "flatten the argument" (print "elephant: arg is " arg)) (args:make-option (f file) (required: "NAME") "parse file NAME") (args:make-option (v V version) #:none "Display version" (print "args-example $Revision: 1.3 $") (exit)) (args:make-option (abc) #:none "Recite the alphabet") (args:make-option (h help) #:none "Display this text" (usage (define (usage) (with-output-to-port (current-error-port) (lambda () (print "Usage: " (car (argv)) " [options...] [files...]") (newline) (print (args:usage opts)) (print "Report bugs to zbigniewsz at gmail."))) (exit 1)) (receive (options operands) (args:parse (command-line-arguments) opts) (print options)) You can see how the behavior of using required arguments (-e or --elephant) differs from using optional arguments (-d or --depth). More specifically, -e and --elephant work, parsing their arguments as expected, whereas -d produces #f except when the option is passed directly after the flag with no spaces (-d10, for example), and --depth always returns #f. Running Ubuntu 17.04 chicken -version: (c) 2008-2017, The CHICKEN Team (c) 2000-2007, Felix L. Winkelmann Version 4.12.0 (rev 6ea24b6) linux-unix-gnu-x86-64 [ 64bit manyargs dload ptables ] compiled 2017-02-19 on yves.more-magic.net (Linux)___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users