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.
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
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
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
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
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