[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: command line arguments'



Bruno wrote:
> 
> Joachim Schrod <schrod@iti.informatik.th-darmstadt.de> asks:
> 
> > Are the command line arguments available in CLISP?
> 
> No, because command line arguments are not reasonably portable across
> all platforms supported by CLISP. (DOS and Atari TOS limit the command
> line length to 128 and 80 characters, respectively, making it unusable
> for "real" applications.) Furthermore, passing quotes and double quotes
> within command line arguments is always a pain and depends on the command
> line interpreter.

Hmm, let me try to convince you... (Get me right: I don't ask you to
do it -- I'll schedule Gabor for that. ;-) But I would like to see
these changes folded back into the main development thread.)

CLISP is implemented in C. C has a defined way to pass command line
arguments, namely via the first two arguments of main(), canonically
called argc and argv. (Actually, my question was simply ``is argv
available as the binding of a CL symbol'' -- obviously, it's not.)

I cannot follow your arguments against providing these values.

 (1) That the command line length in certain OSes is restricted is
     something that holds for _all_ programs there. This is an
     restriction that users of these deficient environments got used
     to. (They didn't have any other chance.) And I wouldn't call most
     applications I use "unreal applications" -- but they don't need
     command line lengths > 80.
     	Actually, _I_ would call applications with such long command
     lines `unusable'. (A synonym to `real'? :-) :-)

 (2) How to pass quotes and double quotes, is IMO not a problem of
     CLISP. It's -- as you write -- a problem of the command line
     interpreter and the C run time library.
     	Those who use a certain CLI must know how to specify quotes in
     it; just like they have to do it in all other programs.

I hope my background wish gots clearer: I want to use Lisp
applications just like any other applications. I want to tell people
`Here is a CLISP image, just use it.' Without having to resort to
shell scripts (written for each OS anew!) where I pass some arguments
via setq etc. Besides here comes exactly the point where your length
argument bites: I don't want to write long -x option arguments in a
DOS .BAT file when I just want to pass a document name!

C'mon, let's go out of the Lisp universe and meet other systems...
(Dick Gabriel has written a nice memo about this problem. ;-)

As an example, my current pet: An SGML style sheet language, realized
as an extension of CLOS; that may be used to transform or query SGML
documents. The cmd line argument is the document(s).

Since I'm at it: I would also like some hook that is evaluated after
a memory image is loaded. (Like \everyjob, for the TeX freaks...
Actually, I want it exactly for this -- I'm working on an executable
formal specification of TeX.) But one can imagine more uses for it,
e.g., reestablishing a link to some display server, etc.
    (I want to have this evaluation _before_ the first form is read,
therefore I cannot use *evalhook*.)

> > Actually I would like to have some symbol (say, in package SYSTEM)
> > that is bound to a list of strings; the arguments that are not already
> > processed by CLISP itself.
> 
> This would be dangerous since we don't know which command line options
> will be added to CLISP in the future.

How about two symbols: system::*raw-argv* and system::*argv* ?
Or a stop token for CLISP options? `--' comes immediately to mind...

	Joachim

--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Joachim Schrod			Email: schrod@iti.informatik.th-darmstadt.de
Computer Science Department
Technical University of Darmstadt, Germany