Lisp options (Was Re: Maxima heap size)



>>>>> "Michel" == Michel Talon <talon at lpthe.jussieu.fr> writes:

    Michel> Hello,
    Michel> I am running out of heap size with maxima compiled with cmucl (running on
    Michel> Linux). I get 

    Michel> *A2 gc_alloc_large failed, nbytes=248.
    Michel>  CMUCL has run out of dynamic heap space (512 MB).
    Michel>   You can control heap size with the -dynamic-space-size commandline option.

    Michel> I have tried to do that, but it doesn't seem to work. I only get the
    Michel> following, but i don't recover the prompt:

    Michel> hercule%  bin/maxima -v "-dynamic-space-size 1632"

I think this raises an issue with the current implementation of
maxima.  It would be nice to be able to specify options to the
underlying lisp implementation.  And I have sometimes wanted to do
what Michel wants.

I have done a little work on this, and have something that kind of
works.  So for Michel's issue, we can invoke maxima as

maxima -o "-dynamic-space-size 1600"

and cmucl will now have a heap of size 1600.

However, I'm a little confused on what expand-args is intended to do.
I've annotated what I think it does here:

(defun expand-args (args)
  (if (null args)
      nil
      (let* ((arg (car args))
	     (rest (expand-args (cdr args)))
	     (listarg (list arg)))
	(cond ((< (length arg) 2) 
               ;; Nothing to do for -x
               nil)
	      ((and (equal (subseq arg 0 2) "--") (search "=" arg))
               ;; Handles things like --foo=value
	       (setf listarg (expand-equals-arg arg)))
	      ((equal (subseq arg 0 2) "--") 
               ;; Nothing special for plain --foo
               nil)
	      ((equal (char arg 0) #\-)
               ;; ***Do we really want this?
	       (if (> (length arg) 2)
		   (setf listarg (expand-compound-arg arg)))))
	(append listarg rest))))

I had to comment that out to get the command line parser to handle '-o
"-dynamic-space-size 1600"'.  With that enabled, the parser thinks
that is

"-o -d -y -n -a -m -i -c -- -s -p -a -c -e -- -s -i -z -e" 

And most of the newly expanded options aren't defined.  I guess that
clause is meant to handle the case of -abc where -a, -b, and -c are
options.  But this doesn't work well if the value of an option looks
like an option.  Expand-args seems too greedy.

Can we live without being able to recognize -abc as three separate
options all smashed into one?

Or maybe we need a new command line parser?  (I'd rather not write a
new one.)

Also, there seems to be a limitation on the number of command line
args that can be handled.  In maxima, we gather up args 1-9 and pass
them to the underlying lisp.  But what if there were more?

Ray