[Bese-devel] Re: CLISP + UCW + SLIME + REPL
Lou Vanek
vanek at acd.net
Wed May 31 16:32:23 UTC 2006
Does anybody have a copy of the modified swank.lisp file Vlado talks about here?
If so, please forward to vanek AT acd DOT net or post in a public, well-lit place.
Much appreciated,
Lou Vanek
vlado tzankov wrote:
> Sorry in the previous mail i forgot that i have changed the
> startup-backend
>
> in the ucw araneida backend - file: src/backend/araneida.lisp
>
> I have removed the last line:
> ;; #+clisp (araneida:host-serve-events))
>
> since it starts a global "REPL" in the described configuration.
>
> On Saturday, November 19, 2005, at 11:26 PM, vlado tzankov wrote:
>
>> The modifications that i have made are:
>>
>> 1. SLIME
>> Attached are the swank.lisp and swank-clisp.lisp.
>> 1.1. swank.lisp
>> when using the :fd-handler (and :sigio) communication style - the
>> lambda passed to the add-fd-handler should have a single parameter -
>> which is ignored in slime, but since the lambda is called now from the
>> araneida - it should have a parameter. This change affects all
>> backends that use fd-handler ot sigio (cmucl, single threaded sbcl).
>> so the backends should be changed as well - (defimplementation
>> add-fd-handler (socket fn)) should be changed in the backends to use
>> the passed lambda.
>> 1.2. swank-clisp.lisp
>> the following functions are added to the file (no other
>> modifications).
>> (defimplementation preferred-communication-style ()
>> (if (find-package 'araneida) :fd-handler nil))
>>
>> (defimplementation add-fd-handler (socket fn)
>> (if (find-package 'araneida)
>> (car (push (cons socket fn) (symbol-value (intern
>> "*FD-HANDLERS*" "ARANEIDA"))))
>> (error "trying to use araneida event handlers without having it
>> loaded.")))
>>
>> (defimplementation remove-fd-handlers (socket)
>> (if (find-package 'araneida)
>> (setf (symbol-value (intern "*FD-HANDLERS*" "ARANEIDA"))
>> (remove socket (symbol-value (intern "*FD-HANDLERS*"
>> "ARANEIDA")) :count 1 :test (lambda (x y) (equal x (car y)))))
>> (error "trying to use araneida event handlers withouit having it
>> loaded")))
>>
>> 2. ARANEIDA
>> The only change here is replacing the function HOST-SERVE-EVENTS
>> in the the compat/compat-clisp.lisp with the following one:
>>
>> (defun host-serve-events ()
>> (loop
>> (let ((current-handlers (copy-list *fd-handlers*))
>> (just-sockets (mapcar (lambda (pair)
>> (if (eq (type-of (car pair)) 'stream)
>> (list (car pair) :input)
>> (list (car pair))))
>> *fd-handlers*)))
>> (loop for j in (socket:socket-status just-sockets) do
>> (let ((x (find-if (lambda (pair) (eql (car j) (car pair)))
>> current-handlers)))
>> (if (or (eq (cdr j) t) (eq (cddr j) :INPUT))
>> (if x (funcall (cdr x) (car x))))
>> (if (and (eq (type-of (car j)) 'stream) (eq (cddr j) :EOF))
>> ;; we do not care about the server-socket, it cannot get :EOF status
>> (host-remove-fd-handler x)))))))
>>
>> (there is consing at each request, but we have to live with it, since
>> the handler of the request may change the *fd-handlers*)
>>
>> 3. And finally - the sequence in starting clisp and everything else
>> i am using the following start script
>>
>> (in-package :common-lisp-user)
>> (asdf:oos 'asdf:load-op 'araneida)
>> (load (merge-pathnames "../slime/swank-loader.lisp" *load-truename*))
>> (load (merge-pathnames "../ucw/bin/start.lisp" *load-truename*))
>> (ucw:startup-server ucw:*default-server*)
>> (swank:create-server :dont-close t)
>> (araneida:host-serve-events)
>>
>> After this from emacs you can do slime-connect and go on.
>>
>> when you try all this - backup you slime files - for cmucl and single
>> threaded sbcl (and all other that use :fd-handler or :sigio) a small
>> patch to the backend should be made. for lisps that use :spawn
>> (openmcl, mp sbcl) there should be no problems - but have not tested it.
>>
>> the host-serve-event in araneida is supposed to work fine - it is
>> compatible with the original code.
>> <swank-clisp.lisp><swank.lisp>
>> br
>> vlado
>>
>>
>> On Saturday, November 19, 2005, at 12:13 PM, Marco Baringer wrote:
>>
>>> vlado tzankov <vtzankov at gmail.com> writes:
>>>
>>>> Hi,
>>>>
>>>> I just managed to patch SLIME and Araneida CLISP support, so I am able
>>>> to run the UCW with Araneida backend and in the same time to connect
>>>> with SLIME to the REPL of the running CLISP. Regardless of single
>>>> threaded CLISP and lack of SERVE-EVENT functionality found in CMUCL
>>>> and SBCL - it is possible to emulate the serve-event stuff with
>>>> SOCKET-STATUS function in CLISP.
>>>>
>>>> So generally CLISP+Araneida+UCW behaves like a multi-threaded system.
>>>
>>>
>>> i could really use this :)
>>>
>>>> If somebody is interested I can post the changes here (or somewhere
>>>> else) - btw the changes are tested only on OS X and CLISP 2.35.
>>>
>>>
>>> post them here.
>>>
>>> --
>>> -Marco
>>> Ring the bells that still can ring.
>>> Forget the perfect offering.
>>> There is a crack in everything.
>>> That's how the light gets in.
>>> -Leonard Cohen
>>>
More information about the bese-devel
mailing list