[Openmcl-devel] Remote REPL

Sven Van Caekenberghe sven at beta9.be
Thu Jan 9 14:22:26 PST 2003


Great! I updated my code at http://homepage.mac.com/svc/remote-repl.lisp
which is now using MAKE-MCL-LISTENER-PROCESS, and it seems to work OK!

Handling ctrl-c is hard I think (how do you send ctrl-c using telnet 
?), but stopping can be done by doing (process-kill *current-process*) 
and the eof behavior doesn't bother me.

Thx,

Sven

PS: Unless we find something very wrong with the code, this should 
definitively become an example.

On Thursday, January 9, 2003, at 05:51 PM, Gary Byers wrote:
>
> On Thu, 9 Jan 2003, Sven Van Caekenberghe wrote:
>
>> Was: RE: Faceless Background Server Behavior
>>
>>> I was looking at
>>> http://www.franz.com/support/tech_corner/telnetserver.lhtml
>>> and reading the code in l1-readloop[-lds].lisp and friends (hard ;-).
>>> Maybe setting *terminal-io* to some socket stream and starting
>>> (toplevel) could do it ? Probably very much oversimplified...
>>>
>>> When I find some more time, I will try something, and I will ask 
>>> again
>>> how to wire it to the openmcl toplevel.
>>
>> So OK, lisp hacking is very addictive, I gave it a try:
>>
>> http://homepage.mac.com/svc/remote-repl.lisp
>>
>> This code kind of works: I could not figure out how to bind
>> *terminal-io* thus no print functions work, break loops and toplevel
>> commands are also absent, but hey you can evaluate lisp code. Anyway,
>> it would be much nicer to use the real openmcl toplevel-loop. I had a
>> look, but I think there must be people who can do this much quicker -
>> it would take me too long to even understand the code....
>>
>> What we need is the equivalent of the acl code:
>>
>> (defun start-telnet-session (s from)
>>    (unwind-protect
>>        (catch 'end-telnet-session
>>          (let ((*in-telnet-session* t))
>>            (tpl:start-interactive-top-level
>>             s 'tpl:top-level-read-eval-print-loop nil)))
>>      (ignore-errors (close s)))
>>    (format t "telnet server: closing connection from ~a~%" from))
>>
>> In particular starting another toplevel loop (I hope that having
>> multiple toplevel loops is different processes possible, otherwise the
>> server could be made single threaded).
>>
>> Sven
>
> OpenMCL's Cocoa demo runs multiple listeners, each in its own thread.
>
> It calls MAKE-MCL-LISTENER-PROCESS, which might not do exactly what
> you want but should give you an idea of how to do it.
>
> An "echoing-two-way-stream" is one which knows that input is echoed
> by the OS (so reading a newline affects STREAM-LINE-COLUMN of the
> output stream.)
>
> There are a few issues that come to mind:
>
>  1) You'd like for ^C to interrupt the listener process that reads it.
>  2) There should be some standard function that terminates a REPL.
>  3) OpenMCL assumes that EOF on an "interactive" stream is a
>     transient condtion; I believe that that's only actually true
>     on ttys/ptys.
>
>
>
>
> _______________________________________________
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
> http://clozure.com/cgi-bin/mailman/listinfo/openmcl-devel
>
>
--
Sven Van Caekenberghe - mailto:sven at beta9.be
Beta Nine - software engineering - http://www.beta9.be
.Mac - svc at mac.com - http://homepage.mac.com/svc


_______________________________________________
Openmcl-devel mailing list
Openmcl-devel at clozure.com
http://clozure.com/cgi-bin/mailman/listinfo/openmcl-devel



More information about the Openmcl-devel mailing list