From: Steve
Subject: ecl and command line arguments
Date: 
Message-ID: <slrndvcoqc.9am.fishing@nowhere.example.com>
Would someone be kind enough to point be towards the ECL equivalent of
SBCL's sb-ext:*posix-argv* or CLISP's ext:*args*? I'd like to use ECL to
generate a "standalone executable" but it turns out that's not really
useful if you can't handle arguments :)

Thanks.

From: Juanjo
Subject: Re: ecl and command line arguments
Date: 
Message-ID: <1140378531.736938.220730@g47g2000cwa.googlegroups.com>
Steve schrieb:
> Would someone be kind enough to point be towards the ECL equivalent of
> SBCL's sb-ext:*posix-argv* or CLISP's ext:*args*? I'd like to use ECL to
> generate a "standalone executable" but it turns out that's not really
> useful if you can't handle arguments :)

First of all, sorry if this is a duplicate, but I do not see my
previous answer in google.

ECL has a function #'si::command-args, which outputs a list with all
command line arguments passed to ECL.

In src/lsp/cmdline.lsp you will also find that the function
#'si::process-command-args can parse these options, load init files,
etc. It is a very nice utility. However, I now see that this interface
is rather limited, as the rules for parsing arguments are stored in a
constant and cannot be modified by standalone applications. I will fix
this in next release.

Juanjo
From: willyh
Subject: Re: ecl and command line arguments
Date: 
Message-ID: <1140450840.467986.173900@f14g2000cwb.googlegroups.com>
You can fetch the arguments with the function #'si::command-args, but
you can't pass any arguments except what are allowed. For example, with
ECL 0.9h (mingw):

$ ecl 1 2 3
Unknown command line option 1.

Usage: ecl [-? | --help]
           [-dir dir] [-load file] [-shell file] [-eval expr] [-rc |
-norc]
           [[-o ofile] [-c [cfile]] [-h [hfile]] [-data [datafile]]
[-s] [-q]
            -compile file]


Juanjo wrote:
> Steve schrieb:
> > Would someone be kind enough to point be towards the ECL equivalent of
> > SBCL's sb-ext:*posix-argv* or CLISP's ext:*args*? I'd like to use ECL to
> > generate a "standalone executable" but it turns out that's not really
> > useful if you can't handle arguments :)
>
> First of all, sorry if this is a duplicate, but I do not see my
> previous answer in google.
>
> ECL has a function #'si::command-args, which outputs a list with all
> command line arguments passed to ECL.
>
> In src/lsp/cmdline.lsp you will also find that the function
> #'si::process-command-args can parse these options, load init files,
> etc. It is a very nice utility. However, I now see that this interface
> is rather limited, as the rules for parsing arguments are stored in a
> constant and cannot be modified by standalone applications. I will fix
> this in next release.
> 
> Juanjo
From: Juanjo
Subject: Re: ecl and command line arguments
Date: 
Message-ID: <1140543546.290669.125920@g47g2000cwa.googlegroups.com>
willyh wrote:
> You can fetch the arguments with the function #'si::command-args, but
> you can't pass any arguments except what are allowed. For example, with
> ECL 0.9h (mingw):

As I said, this is because the set of allowed options is fixed in a
constant list. My intention is to make this more flexible in a coming
release.

Juanjo
From: Juanjo
Subject: Re: ecl and command line arguments
Date: 
Message-ID: <1141388906.001676.150710@v46g2000cwv.googlegroups.com>
Sorry, I forgot to mention that if you want to pass extra arguments to
your application, you have to prepend them by a '--', as in most unix
utilities. Thus, you can make
          ecl -norc -- 1 2 3
Then it is up to your standalone application to parse the extra
arguments. The obvious reason for this is that ECL has its own command
line options. I should probably fix the help message, though.

Juanjo
From: willyh
Subject: Re: ecl and command line arguments
Date: 
Message-ID: <1141393198.033025.14640@e56g2000cwe.googlegroups.com>
Thanks. I'll add it to my ecl notes.

Cheers,

Willy

Juanjo wrote:
> Sorry, I forgot to mention that if you want to pass extra arguments to
> your application, you have to prepend them by a '--', as in most unix
> utilities. Thus, you can make
>           ecl -norc -- 1 2 3
> Then it is up to your standalone application to parse the extra
> arguments. The obvious reason for this is that ECL has its own command
> line options. I should probably fix the help message, though.
> 
> Juanjo