All Manuals > CAPI User Guide and Reference Manual > 21 CAPI Reference Entries

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. We are considering deprecating interactive-pane - please contact Lisp Support if you use it.

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 top-level-function is called on a separate process from the process that displays the pane and does editor interaction. If the top-level-function wants to invoke CAPI functionality, it needs to use apply-in-pane-process to ensure it is done on the right process. If the top-level-function returns, the process just exits, but the pane itself stays and continues to function as an editor-pane.

Note that because the pane is a fully functional editor-pane, the user can perform complex operations, and the top-level-function should try to cope with it. For example, the user may yank a very large amount of text, or may delete half of the buffer.

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.

Notes

The class listener-pane is built upon interactive-pane. listener-pane adds functionality for handling Lisp forms and handles complexities involved with the interaction with the Editor, so it is much easier to use. If you use interactive-pane directly please contact Lisp Support.

Compatibility note

This class was named interactive-stream in LispWorks 3.2 but has been renamed to avoid confusion (as this class is not a stream but a pane that contains a stream). interactive-stream and its accessors interactive-stream-top-level-function and interactive-stream-stream have now been removed.

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
Stream panes


CAPI User Guide and Reference Manual (Unix version) - 25 Feb 2015

NextPrevUpTopContentsIndex