summaryrefslogtreecommitdiff
blob: b33ca6e67cb0fb773beb0e81eadda3f53cf62bd6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
;;;; -*- Mode: Lisp; indent-tabs-mode: nil -*-

(defpackage #:swank-system
  (:use #:common-lisp #:asdf))

(in-package #:swank-system)

(defun load-user-init-file ()
  "Load the user init file, return NIL if it does not exist."
  (load (merge-pathnames (user-homedir-pathname)
                         (make-pathname :name ".swank" :type "lisp"))
        :if-does-not-exist nil))

(defun load-site-init-file ()
  (load (make-pathname :name "site-init" :type "lisp"
                       :defaults (truename
                                  (asdf:system-definition-pathname
                                   (asdf:find-system :swank))))
        :if-does-not-exist nil))

(defclass no-load-file (cl-source-file) ())

(defmethod perform ((op load-op) (c no-load-file)) nil)

(defmacro define-swank-system (sysdep-files)
  `(defsystem :swank
     :description "Swank is the Common Lisp back-end to SLIME"
     :serial t
     :components ((:file "swank-backend")
                  (:file "nregex")
                  ,@(mapcar #'(lambda (component)
                                (if (atom component)
                                    (list :file component)
                                    component))
                            sysdep-files)
                  (:file "swank-match")
                  (:file "swank-rpc")
                  (:file "swank")
                  (:module "contrib"
                   :components ((:no-load-file "swank-c-p-c")
                                (:no-load-file "swank-arglists"
                                 :depends-on ("swank-c-p-c"))
                                (:no-load-file "swank-asdf")
                                (:no-load-file "swank-clipboard")
                                (:no-load-file "swank-fancy-inspector")
                                (:no-load-file "swank-fuzzy"
                                 :depends-on ("swank-c-p-c"))
                                (:no-load-file "swank-hyperdoc")
                                (:no-load-file "swank-indentation")
                                (:no-load-file "swank-listener-hooks")
                                (:no-load-file "swank-media")
                                (:no-load-file "swank-motd")
                                (:no-load-file "swank-package-fu")
                                (:no-load-file "swank-presentations")
                                (:no-load-file "swank-presentation-streams"
                                 :depends-on ("swank-presentations"))
                                (:no-load-file "swank-sbcl-exts"
                                 :depends-on ("swank-arglists"))
                                (:no-load-file "swank-snapshot")
                                (:no-load-file "swank-sprof"))))
     :depends-on (#+sbcl sb-bsd-sockets)
     :perform (load-op :after (op swank)
                       (load-site-init-file)
                       (load-user-init-file))))

#+(or cmu scl sbcl openmcl clozurecl lispworks allegro clisp armedbear cormanlisp ecl)
(define-swank-system
  #+cmu (swank-source-path-parser swank-source-file-cache swank-cmucl)
  #+scl (swank-source-path-parser swank-source-file-cache swank-scl)
  #+sbcl (swank-source-path-parser swank-source-file-cache swank-sbcl swank-gray)
  #+(or openmcl clozurecl) (metering
                            #.(if (and (find-package "CCL")
                                       (fboundp (intern "COMPUTE-APPLICABLE-METHODS-USING-CLASSES" "CCL")))
                                  'swank-ccl
                                  'swank-openmcl)
                            swank-gray)
  #+lispworks (swank-lispworks swank-gray)
  #+allegro (swank-allegro swank-gray)
  #+clisp (xref metering swank-clisp swank-gray)
  #+armedbear (swank-abcl)
  #+cormanlisp (swank-corman swank-gray)
  #+ecl (swank-source-path-parser swank-source-file-cache swank-ecl swank-gray))

#-(or cmu scl sbcl openmcl clozurecl lispworks allegro clisp armedbear cormanlisp ecl)
(error "Your CL implementation is not supported !")

(defpackage #:swank-loader
  (:use #:common-lisp)
  (:export #:*source-directory*))

(in-package #:swank-loader)

(defparameter *source-directory*
  (asdf:component-pathname (asdf:find-system :swank)))

;; (funcall (intern (string :warn-unimplemented-interfaces) :swank-backend))

;; swank.asd ends here