NextPrevUpTopContentsIndex

interactive-pane

Class
Summary

An interactive-pane is an editor with a process reading and processing input, and that collects any output into itself. The class listener-pane is built upon this, and adds functionality for handling Lisp forms.

Package

capi

Superclasses

editor-pane

Subclasses

listener-pane
shell-pane

Initargs

:top-level-function

The input processing function.

Readers

interactive-pane-stream
interactive-pane-top-level-function

Description

An interactive-pane contains its own GUI stream. The top-level-function is called once, when the interactive pane is created: it needs to repeatedly take input from the GUI stream and write output to it.

The first argument to top-level-function is the interface containing the interactive pane. The second argument is the interactive pane itself. The third argument is the GUI stream. The default for top-level-function is a function which runs a Lisp listener top-loop.

Compatibility Note

This class was named interactive-stream in LispWorks 3.2 but has been renamed to avoid confusion (this class is not a stream but a pane that contains a stream). The class interactive-stream and its accessors interactive-stream-top-level-function and interactive-stream-stream have been kept for compatibility but may be dropped in future versions of LispWorks.

Example

This example assumes there is just one line of output from each command sent to the pipe

(capi:contain
 (make-instance
  'capi:interactive-pane
  :top-level-function
  #'(lambda (interface pane stream)
      (declare (ignore interface pane))
      (with-open-stream (s (sys:open-pipe 
                            '("/usr/local/bin/bash")
                            :direction :io))
        (loop 
         (progn
           (format stream "primitive xterm$ ")
           (let ((input (read-line stream nil nil)))
             (if input
                 (progn
                   (write-line input s)
                   (force-output s))
               (return))))
         (let ((output (read-line s nil nil)))
           (if output
               (progn
                 (write-line output stream)
                 (force-output stream))
             (return)))))))
 :best-height 300
 :best-width 300)
See also

collector-pane


LispWorks CAPI Reference Manual - 25 Jul 2006

NextPrevUpTopContentsIndex