;ELC ;;; compiled by cthomp@willow on Fri Sep 3 14:46:49 1993 ;;; from file /export/willow0/era-working/editor/lisp/ilisp/bridge.el ;;; emacs version 19.8 (beta12) Lucid. ;;; bytecomp version 2.18; 28-aug-93. ;;; optimization is on. ;;; this file uses opcodes which do not exist in Emacs 18. (if (and (boundp 'emacs-version) (or (and (boundp 'epoch::version) epoch::version) (string-lessp emacs-version "19"))) (error "This file was compiled for Emacs 19.")) (defvar bridge-hook nil "\ Hook called when a bridge is installed by install-hook.") (defvar bridge-start-regexp "" "\ *Regular expression to match the start of a process bridge in process output. It should be followed by a buffer name, the data to be sent and a bridge-end-regexp.") (defvar bridge-end-regexp "" "\ *Regular expression to match the end of a process bridge in process output.") (defvar bridge-prompt-regexp nil "\ *Regular expression for detecting a prompt. If there is a comint-prompt-regexp, it will be initialized to that. A prompt before a bridge-end-regexp will stop the process bridge.") (defvar bridge-handlers nil "\ Alist of (regexp . handler) for handling process output delimited by bridge-start-regexp and bridge-end-regexp. The first entry on the list whose regexp matches the output will be called on the process and the delimited output.") (defvar bridge-source-insert t "\ *T to insert bridge input in the source buffer minus delimiters.") (defvar bridge-destination-insert t "\ *T for bridge-send-handler to insert bridge input into the destination buffer minus delimiters.") (defvar bridge-chunk-size 512 "\ *Long inputs send to comint processes are broken up into chunks of this size. If your process is choking on big inputs, try lowering the value.") (defvar bridge-old-filter nil "\ Old filter for a bridged process buffer.") (defvar bridge-string nil "\ The current output in the process bridge.") (defvar bridge-in-progress nil "\ The current handler function, if any, that bridge passes strings on to, or nil if none.") (defvar bridge-send-to-buffer nil "\ The buffer that the default bridge-handler (bridge-send-handler) is currently sending to, or nil if it hasn't started yet. Your handler function can use this variable also.") (defvar bridge-last-failure nil "\ Last thing that broke the bridge handler. First item is function call (eval'able); last item is error condition which resulted. This is provided to help handler-writers in their debugging.") (fset 'bridge-insert #[(output) "p ! !  ! =` U ! bc `ȓ) b`\"?  !! !*-" [output buffer get-buffer-process process process-mark mark selected-window window nil at-end window-buffer get-buffer-window pos-visible-in-window-p original select-window recenter (center)] 3 "\ Insert process OUTPUT into the current buffer."]) (fset 'bridge-send-string #[(process string) "G\n^  O\" W \n\\  ^O\")b*" [string len bridge-chunk-size i process-send-string process 0 next-i accept-process-output] 7 "\ Send PROCESS the contents of STRING as input. This is equivalent to process-send-string, except that long input strings are broken up into chunks of size comint-input-chunk-size. Processes are given a chance to output between chunks. This can help prevent processes from hanging when you send them long inputs on some OS's."]) (fset 'bridge-call-handler #[(handler proc string) "ŏ *?" [nil failed inhibit-quit err (funcall handler proc string) ((error (byte-code "  # D D\nFE " [ding t failed message "bridge-handler \"%s\" failed %s (see bridge-last-failure)" handler err funcall quote proc string "Caused: " bridge-last-failure] 4)))] 3 "\ Funcall HANDLER on PROC, STRING carefully. Error is caught if happens, and user is signaled. State is put in bridge-last-failure. Returns t if handler executed without error."]) (fset 'bridge-send-handler #[(process input) "\n!!@\" ! !AO \n ! ! p  Ύ q !dbc) \") \"," [input nil bridge-send-to-buffer to dest buffer-name buffer-and-start read-from-string format "%s" get-buffer get-buffer-process buffer bridge-destination-insert ((set-buffer buffer)) bridge-insert bridge-send-string error "%s is not a buffer"] 4 "\ Send PROCESS INPUT to the buffer name found at the start of the input. The input after the buffer name is sent to the buffer's process if it has one. If bridge-destination-insert is T, the input will be inserted into the buffer. If it does not have a process, it will be inserted at the end of the buffer."]) (fset 'bridge-filter #[(process output) " p !ĉʼn \n   \nq Ŏ\nGW   #ĕĔʼn#ĕ\n)G\nG#ĕX ĕ\n) \nU \nO ! \" != \"*\nq!) !! !@\"\"@###W\"A !A!*O   ) %UO&'&! &#%)%\nU # )\n +) q !. " [t match-data process-buffer process 0 nil b-end b-start-end b-start function end start case-fold-search buffer inhibit-quit bridge-in-progress output string-match bridge-start-regexp bridge-end-regexp end-seen bridge-prompt-regexp prompt pass-on bridge-old-filter old store-match-data process-filter new bridge-filter set-process-filter bridge-insert bridge-handlers handlers handler m bridge-send-handler ok send bridge-source-insert bridge-call-handler] 12 "\ Given PROCESS and some OUTPUT, check for the presence of bridge-start-regexp. Everything prior to this will be passed to the normal filter function or inserted in the buffer if it is nil. The output up to bridge-end-regexp will be sent to the first handler on bridge-handlers that matches the string. If no handlers match, the input will be sent to bridge-send-handler. If bridge-prompt-regexp is encountered before the bridge-end-regexp, the bridge will be cancelled."]) (fset 'install-bridge #[nil "p!p!\"!!!!!!!!!!! !p!!=! \"p!\")!!" [get-buffer-process error "%s does not have a process" buffer-name make-local-variable bridge-start-regexp bridge-end-regexp bridge-prompt-regexp bridge-handlers bridge-source-insert bridge-destination-insert bridge-chunk-size bridge-old-filter bridge-string bridge-in-progress bridge-send-to-buffer nil boundp comint-prompt-regexp process process-filter bridge-filter set-process-filter run-hooks bridge-hook message "Process bridge is installed"] 5 "\ Set up a process bridge in the current buffer." nil]) (fset 'reset-bridge #[nil "p!\")!" [bridge-in-progress ((byte-code "" [nil bridge-in-progress] 1)) get-buffer-process nil message "No bridge in progress."] 3 "\ Must be called from the process's buffer. Removes any active bridge." nil]) (fset 'remove-bridge #[nil "p! !=p!\"  \" \n\"!)" [get-buffer-process process process-filter bridge-filter error "%s has no bridge" buffer-name reset-bridge set-process-filter bridge-old-filter bridge-string message "Process bridge is removed."] 5 "\ Remove bridge from the current buffer." nil]) (fset 'hand-bridge #[(start end) " \n^ !`! \n]#`!  p!  {\"*" [current-prefix-arg start end looking-at bridge-start-regexp error "Not looking at bridge-start-regexp" re-search-forward bridge-end-regexp nil t "Didn't see bridge-end-regexp" p1 p0 bridge-filter get-buffer-process] 5 "\ With point at bridge-start, sends bridge-start + string + bridge-end to bridge-filter. With prefix, use current region to send." "r"]) (provide 'bridge)