RE: Adding commands to LispWorks toplevel
Ok, I'll try this. Thanks. And, I'll also look for Tim's code when he has a
moment to post it.
Much obliged,
David
-----Original Message-----
From: David Fox [mailto:davef@xanalys.com]
Sent: Tuesday, July 01, 2003 3:40 PM
To: dyoung@bloodhoundinc.com
Cc: lisp-hug@xanalys.com
Subject: Re: Adding commands to LispWorks toplevel
Greetings. Is it possible to add user-defined commands to the LispWorks
toplevel? For example, I might want to add a :PA command that changes
packages. This capability is available in Allegro, and since LispWorks is
such a stellar product I'm sure I've overlooked something. Thanks...
We ought to provide an interface to this, but don't currently, sorry.
For the moment, you can use the same approach as ILISP:
--------------------- lispworks.lisp ---------------------------------
(unless (fboundp 'sys::define-top-loop-handler)
;; Duplicated from ccl/top-loop.lisp
(defmacro sys::get-top-loop-handler (command-name)
`(get ,command-name 'sys::top-loop-handler))
(defmacro sys::define-top-loop-handler (name &body body)
(lw:with-unique-names (top-loop-handler)
`(let ((,top-loop-handler #'(lambda (sys::line) ,@body)))
(mapc #'(lambda (name)
(setf (sys::get-top-loop-handler name) ,top-loop-handler))
(if (consp ',name) ',name '(,name))))))
)
(sys::define-top-loop-handler :ilisp-send
(values (multiple-value-list (eval (cadr sys::line))) nil))
----------------------------------------------------------------------
Dave Fox
Xanalys
Compass House
Vision Park
Chivers Way
Histon
Cambridge
CB4 9AD
England
Email: davef@xanalys.com
Tel: +44 1223 253793
Fax: +44 1223 257812
These opinions are not necessarily those of Xanalys.