Initial commit.
						commit
						7a26e3dd71
					
				| @ -0,0 +1 @@ | ||||
| This is the stub README.txt for the "cl-init" project. | ||||
| @ -0,0 +1,11 @@ | ||||
| ;;;; cl-init.asd | ||||
| 
 | ||||
| (asdf:defsystem #:cl-init | ||||
|   :serial t | ||||
|   :description "Describe cl-init here" | ||||
|   :author "Your Name <your.name@example.com>" | ||||
|   :license "Specify license here" | ||||
|   :depends-on (#:swank) | ||||
|   :components ((:file "package") | ||||
|                (:file "cl-init"))) | ||||
| 
 | ||||
| @ -0,0 +1,32 @@ | ||||
| (in-package #:cl-init) | ||||
| 
 | ||||
| (defparameter *start-thunk* #'(lambda () nil)) | ||||
| (defparameter *stop-thunk* #'(lambda () nil)) | ||||
| 
 | ||||
| (defparameter *shutdown-port* 6200) | ||||
| 
 | ||||
| (require 'swank) | ||||
| (defparameter *swank-port* 4006) | ||||
| (defparameter *swank-server* nil) | ||||
| 
 | ||||
| (defun run () | ||||
|   (format t "~A ~S~%" "starting swank on port" *swank-port*) | ||||
|   (setf *swank-server* | ||||
|         (swank:create-server :port *swank-port* :dont-close t)) | ||||
|   (format t "swank started~%starting external process~%") | ||||
| 
 | ||||
|   (apply *start-thunk* nil) | ||||
|   (format t "external process running~%") | ||||
| 
 | ||||
|   ; wait for stop signal | ||||
|   (let* ((socket (ccl:make-socket :local-port *shutdown-port* :connect :passive)) | ||||
|          (stream (ccl:accept-connection socket))) ; wait for anything | ||||
|     (close stream) | ||||
|     (close socket)) | ||||
| 
 | ||||
|   (format t "stopping external process~%") | ||||
|   (apply *stop-thunk* nil) | ||||
|   (format t "external process stopped~%stopping swank~%") | ||||
|   (swank:stop-server *swank-port*) | ||||
|   (format t "swank stopped~%") | ||||
|   (ccl:quit)) | ||||
| @ -0,0 +1,4 @@ | ||||
| (defpackage #:cl-init | ||||
|   (:use #:cl) | ||||
|   (:export #:*swank-port* #:*start-thunk* #:*stop-thunk* #:run)) | ||||
| 
 | ||||
					Loading…
					
					
				
		Reference in New Issue