source: trunk/source/cocoa-ide/swank-ccl-ide.el @ 12150

Last change on this file since 12150 was 12150, checked in by mikel, 11 years ago

added a bunch of the server-side request-handling code for the swank-listener.

switched the swank loader back on (but made sure swank isn't loaded unless the user default says it should be)

File size: 1.9 KB
Line 
1;;;; ***********************************************************************
2;;;; FILE IDENTIFICATION
3;;;;
4;;;; Name:          swank-ccl-ide.el
5;;;; Project:       CCL IDE
6;;;; Purpose:       swank extensions for use with the CCL IDE
7;;;;
8;;;; ***********************************************************************
9
10;;; ABOUT
11;;; ------------------------------------------------------------------------
12
13;;; this file implements an extension to SLIME that talks to CCL's
14;;; Cocoa app
15;;; it provides utilities that:
16;;; 1. tell CCL to find and load the swank-loader currently in use by
17;;;    the running Emacs
18;;; 2.  start a swank server on a specified port.
19;;; 3. tell SLIME to connect to swank on the specified port
20
21(defun swank-loader-path () (concat slime-path "swank-laoder.lisp"))
22
23(defvar *ccl-swank-listener-host* "127.0.0.1")
24(defvar *ccl-swank-listener-port* 4884)
25(defvar *ccl-swank-listener-proc* nil)
26
27
28;;; TODO: make this filter function start up a connection to
29;;;       the CCL swank server if it reads a success message,
30;;;       or display an informative error if it reads a
31;;;       failure message
32(defun slime-ccl-swank-filter (process string)
33  (message (concat "CCL swank listener: " string)))
34
35(defvar $emacs-ccl-swank-request-marker "[emacs-ccl-swank-request]")
36
37(defun request-ccl-load-swank (&optional 
38                               (host *ccl-swank-listener-host*)
39                               (listener-port *ccl-swank-listener-port*)
40                               (connection-port slime-port))
41  (let ((ping (concat $emacs-ccl-swank-request-marker (format "%d" connection-port) ":" (swank-loader-path) "\n"))
42        (ccl-proc (open-network-stream "SLIME CCL Swank" nil host listener-port)))
43    (setq *ccl-swank-listener-proc* ccl-proc)
44    (set-process-filter ccl-proc 'slime-ccl-swank-filter)
45    ;; send ping
46    (process-send-string ccl-proc ping)
47    ccl-proc))
48
Note: See TracBrowser for help on using the repository browser.