Subject: [clisp-list] accessing command-line-arguments from within clisp

From: D. Goel <[email-masked]>
Date: Tue Oct 22 11:06:01 2002

Hello

is there a way to access command line arguments from within clisp?
Else, WIBNI to provide a way? -- if so, could this be treated as a
feature-request? thanks

In ACL, i could have dump an image and then call:

image -- "foo" "bar" ... 

and the variable command-line-arguments was then bound to '("image"
"foo" "bar"), which made for a nice interface...

In clisp (2.30) , i don't seem to see a similar functionality. 

I do see an *args*, but am very confused as to its usage..
I have tried, clisp "" "foo" "bar", hoping that arg will then be bound
to '("foo" "bar").  Instead clisp tries to look for files foo and bar
:( 

Secondly, it seems from the doc that *args* is only temporarily bound.

Any help appreciated. 

(I am trying to port an application written in ACL to clisp, and
command-line-arguments seems to be the last stumbling block.)

DG                                 http://deego.gnufans.org/~deego/
--

---

From: Ayan George <[email-masked]>
Date: Tue Oct 22 11:19:01 2002

Hey,

Try:

	clisp <lisp_source_file> <arg0> <arg1> ... <argN>

Where if you have foo.lisp that contains:

	( print *args* )

You can call foo.lisp thusly:

$ clisp foo.lisp "foo" "bar"
("foo" "bar") 

-Ayan

On 22 Oct 2002, D. Goel wrote:

> -------------------------------------------------------
> This sf.net emial is sponsored by: Influence the future 
> of Java(TM) technology. Join the Java Community 
> Process(SM) (JCP(SM)) program now. 
> http://ad.doubleclick.net/clk;4699841;7576301;v?http://www.sun.com/javavote
> _______________________________________________
> clisp-list mailing list
> [email-masked]
> https://lists.sourceforge.net/lists/listinfo/clisp-list
>

---

From: Sam Steingold <[email-masked]>
Date: Tue Oct 22 12:13:24 2002

> * In message <[email-masked]>
> * On the subject of "[clisp-list] accessing command-line-arguments from within clisp"
> * Sent on 22 Oct 2002 14:05:06 -0400
> * Honorable "D. Goel" <[email-masked]> writes:
>

<http://clisp.cons.org/clisp.html#opt-exec-file>
<http://clisp.cons.org/impnotes.html#image>

$ clisp -x '(saveinitmem "foo" :init-function (lambda () (print *args*) (exit)))'
990292 ;
524288
$ clisp -M foo.mem "" a b c d

("a" "b" "c" "d")
$

--
Sam Steingold (http://www.podval.org/~sds) running RedHat8 GNU/Linux
<http://www.camera.org> <http://www.iris.org.il> <http://www.memri.org/>
<http://www.mideasttruth.com/> <http://www.palestine-central.com/links.html>
Single tasking: Just Say No.

---

From: D. Goel <[email-masked]>
Date: Tue Oct 22 14:20:05 2002

Thanks for your messages, Ayan and Sam.

Now i do see the (someewhat roundabout) way to get an image to store its
arguments in a clisp varible.

But again, WIBNI if clisp did that by default---store the commandline
as a string or a list of arguemnts, in a global variable...

---

From: Sam Steingold <[email-masked]>
Date: Tue Oct 22 14:52:01 2002

> * In message <[email-masked]>
> * On the subject of "Re: [clisp-list] accessing command-line-arguments from within clisp"
> * Sent on 22 Oct 2002 17:19:44 -0400

Why do you need the -q/-norc/-M/-m ... ?
-B is ext:lib-directory (see impnotes).
-L is ext:current-language (ditto).

all the other (i.e., non-CLISP-defined) arguments _are_
made available in *args*.

-- 
Sam Steingold (http://www.podval.org/~sds) running RedHat8 GNU/Linux
<http://www.camera.org> <http://www.iris.org.il> <http://www.memri.org/>
<http://www.mideasttruth.com/> <http://www.palestine-central.com/links.html>
Sex is like air.  It's only a big deal if you can't get any.

---

From: D. Goel <[email-masked]>
Date: Wed Oct 23 06:06:02 2002

> -L is ext:current-language (ditto).

I don't need them (right now), but i guess it can't hurt to have that
information available inside clisp as well..

> 
> all the other (i.e., non-CLISP-defined) arguments _are_ made
> available in *args*.

Yes, although as i understand it, *args* is bound only temporarily to
those arguments, that too while loading a file.  (i guess, the common
lisp specs must surely be allowing for some variables which an
implementation can bind as it chooses... one such variable could be
bound permamnently to initial-args..)

Anyhow, this is just a minor wishlist.  You all have solved my
problem, and thanks a ton for the same...  CLISP rocks.

---

From: Sam Steingold <[email-masked]>
Date: Wed Oct 23 08:09:04 2002

> * In message <[email-masked]>
> * On the subject of "Re: accessing command-line-arguments from within clisp"
> * Sent on 23 Oct 2002 09:05:42 -0400
> * Honorable D. Goel <[email-masked]> writes:
>

I think you are somewhat confused.
*args* is _always_ _set_ (as in SETQ) to the list of _all_ arguments
that have _not_ been processed and taken care of by CLISP.

-- 
Sam Steingold (http://www.podval.org/~sds) running RedHat8 GNU/Linux
<http://www.camera.org> <http://www.iris.org.il> <http://www.memri.org/>
<http://www.mideasttruth.com/> <http://www.palestine-central.com/links.html>
You can have it good, soon or cheap.  Pick two...