From: <da...@de...> - 2004-01-12 23:07:08
|
The following message is a courtesy copy of an article that has been posted to comp.lang.scheme as well. Jens Axel Søgaard <jen...@so...> writes: > David N. Welton wrote: > > [ Please CC replies to me - thanks! ] > That's against etiquette. If people send the answer directly to you, > then later people having the same problem can't find the answer in > the archives. I would agree with you had I asked you to respond directly to me, but I only asked the courtesy of a CC so as to make my life a bit easier. Most newsreaders let you do that quite easily. > > I have a question about mzscheme's processing of command line > > options. I'm using this code: > > (define (main args) (display "hello world") (newline)) > > and trying to run it like so: > > VERSION 205: > > @eugene [~] $ mzscheme -f hello.mzscheme -v -C hello.mzscheme 1 > > hello world > > VERSION 203: > > @ashland [~] $ mzscheme -f hello.mzscheme -v -C hello.mzscheme 1 > > Welcome to MzScheme version 203, Copyright (c) 1995-2002 PLT > > hello world(hello.mzscheme 1) > Are you sure the contents of hello.mzscheme is the same at eugene > and ashland? Positive, but I'm willing to change the contents to achieve my goal. > > But even worse: > > 203: > > @ashland [~] $ mzscheme -f hello.mzscheme -v -C 1 > > Welcome to MzScheme version 203, Copyright (c) 1995-2002 PLT > > hello world(1) > > 205: > > @eugene [~] $ mzscheme -f hello.mzscheme -v -C 1 > > default-load-handler: cannot open input file: "/home/davidw/1" (No such file or directory; errno=2) > Try moving the -C switch: > @eugene [~] $ mzscheme -C hello.mzscheme foo bar Fails in 203: @ashland [~] $ mzscheme -C hello.mzscheme foo bar Welcome to MzScheme version 203, Copyright (c) 1995-2002 PLT reference to undefined identifier: main > > The explanation of -C in mzscheme 205 is: > -C, --main : Like -r, then call `main' w/argument list; car is file name. > -r, --script : Script mode: use as last switch for scripts. Same as -fmv-. > Since -fmv- is short for -f -m -v -- and in particular contains -f > which is followed by a filename, the name after -C (namely 1) is > interpreted as a filename, and mzscheme will try to load it, > resulting in the above errror. Sure, that makes sense, but it's a pity that it is not consistent between the two versions. > -f <file>, --load <file> : Loads <file> after MzScheme starts. > -- : No argument following this switch is used as a switch. > -m, --mute-banner : Suppresses the startup banner text. > -v, --version : Suppresses the read-eval-print loop. > The best solution is to upgrade mzscheme to version 205. I can do that when it arrives Debian testing. > If you can't get the same switches to work in both versions, then > put this in hello.mzscheme : > (define (main args) > (display "Hello World") (newline) > (display args) (newline)) > (main (vector->list (current-command-line-arguments))) > and start it with > mzscheme -v -m -f hello.mzscheme -- foo bar Beautiful! That's what I was after, thankyou:-) -- David N. Welton Consulting: http://www.dedasys.com/ Personal: http://www.dedasys.com/davidw/ Free Software: http://www.dedasys.com/freesoftware/ Apache Tcl: http://tcl.apache.org/ |