top-level-read-eval-print-loop

$Revision: 5.0.2.4 $

Function

Package: TOP-LEVEL

Arguments: nil

Although the basic algorithm of a Lisp listener is a simple repetition of

(print (eval (read)))

it is greatly complicated by the need to handle command history, error levels, and other useful features. When an application needs a Lisp listener, often it will be simplest to use this, the default Lisp listener provided by the Allegro CL top level. It takes no arguments, but must be run inside a tpl:start-interactive-top-level function.

Thus, the Allegro CL idiom for running a standard Lisp listener communicating with *terminal-io* (this might be done in a excl:*restart-app-function*) looks something like this:

(tpl:start-interactive-top-level *terminal-io*
   #'tpl:top-level-read-eval-print-loop
   nil)

And the idiom for running a standard Lisp listener inside a window looks something like this:

(process-run-function "My Lisp Listener"
   #'tpl:start-interactive-top-level
   my-window-stream
   #'tpl:top-level-read-eval-print-loop
   nil)

Entry to tpl:top-level-read-eval-print-loop establishes additional bindings for certain variables used by the top level loop. These bindings are established inside any bindings established by tpl:start-interactive-top-level. The variables and initial binding values are taken from the alist bound to the (unexported) variable excl::*default--lisp-listener-bindings*.

An operator with this name but with a different definition is used in a Lisp image built with a minimal top level, that is built with the include-tpl argument to build-lisp-image specified nil. See 10.0 Minimal top levels in building_images.htm for information on minimal top levels. Follow the link to see the definition (Lisp source code) of tpl:top-level-read-eval-print-loop in a minimal top level.

See top_level.htm for more information on the top level.

The general documentation description is in introduction.htm. The index is in index.htm.

Copyright (C) 1998-1999, Franz Inc., Berkeley, CA. All Rights Reserved.