commit 7a26e3dd71c590fd763525229361c4fc0a27484c Author: Thomas Hintz Date: Sat Feb 1 09:18:05 2014 -0800 Initial commit. diff --git a/README.txt b/README.txt new file mode 100644 index 0000000..f7c838a --- /dev/null +++ b/README.txt @@ -0,0 +1 @@ +This is the stub README.txt for the "cl-init" project. diff --git a/cl-init.asd b/cl-init.asd new file mode 100644 index 0000000..b541809 --- /dev/null +++ b/cl-init.asd @@ -0,0 +1,11 @@ +;;;; cl-init.asd + +(asdf:defsystem #:cl-init + :serial t + :description "Describe cl-init here" + :author "Your Name " + :license "Specify license here" + :depends-on (#:swank) + :components ((:file "package") + (:file "cl-init"))) + diff --git a/cl-init.lisp b/cl-init.lisp new file mode 100644 index 0000000..c6ca16c --- /dev/null +++ b/cl-init.lisp @@ -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)) diff --git a/package.lisp b/package.lisp new file mode 100644 index 0000000..ff6a725 --- /dev/null +++ b/package.lisp @@ -0,0 +1,4 @@ +(defpackage #:cl-init + (:use #:cl) + (:export #:*swank-port* #:*start-thunk* #:*stop-thunk* #:run)) +