[Openmcl-devel] Remote REPL
gb at clozure.com
Thu Jan 9 08:51:53 PST 2003
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:
> 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)
> (catch 'end-telnet-session
> (let ((*in-telnet-session* t))
> 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).
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
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
Openmcl-devel mailing list
Openmcl-devel at clozure.com
More information about the Openmcl-devel