[Ecls-list] ECL-generated executables and restarts

Matthew Mondor mm_lists at pulsar-zone.net
Thu Jan 20 10:13:58 UTC 2011


Hello again,

If using a build script such as follows:

(pushnew :mm-ecl-standalone *features*)
(declaim (optimize (speed 0) (safety 3) (debug 3)))
(compile-file "/path/to/program.lisp" :output-file "/tmp/program.o" :system-p t)
(c::build-program "/tmp/program" :lisp-files '("/tmp/program.o"))
(ext:quit)

And program.lisp contains the following to when invoked call its main function:

#+:mm-ecl-standalone
(defparameter config-file nil)
#+:mm-ecl-standalone
(defun standalone-main ()
  (let ((ext:*lisp-init-file-list* nil))
    (defun help (stream)
      (format stream "~%program [-config <file>]~%")
      (ext:quit 1))

    (defconstant +arg-rules+
      '(("-config" 1 (setf config-file 1))
        ("*DEFAULT*" 0 (help *standard-output*))))

    (handler-case (ext:process-command-args :rules +arg-rules+)
      (error ()
        (help *error-output*)))

    (unless config-file
      (help *error-output*))

    (load config-file)
    (main))) ; XXX Anything special I should do here?
#+:mm-ecl-standalone
(standalone-main) ; XXX Or here?

Then:
$ /tmp/program -config /tmp/config.lisp

Appears to work.  However, I noticed that although in the SLIME REPL
custom-registered restarts are shown and can be used, i.e. at reception
of SIGINT, those restarts are no longer available in the standalone
debugger.

For instance, I have a CONTINUE-LOOP restart, along with a
CONTINUE-RECONNECT one which show up in the SLIME REPL debugger if
issuing SIGINT, but anymore in the standalone executable.

Is there something my program must do to have a normal debugger
including custom restarts when an unhandled condition occurs?

Also, is what I'm doing sane, or would it be best to use the
prologue/epilogue features of c::build-program?

Thanks,
-- 
Matt




More information about the ecl-devel mailing list