/[slime]/slime/swank-loader.lisp
ViewVC logotype

Contents of /slime/swank-loader.lisp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.14 - (show annotations)
Mon Jan 19 20:15:19 2004 UTC (10 years, 3 months ago) by lgorrie
Branch: MAIN
Changes since 1.13: +3 -1 lines
Call (swank:warn-unimplemented-interfaces).
1 ;;;; -*- Mode: lisp; indent-tabs-mode: nil -*-
2 ;;;
3 ;;; swank-loader.lisp --- Compile and load the Slime backend.
4 ;;;
5 ;;; Created 2003, James Bielman <jamesjb@jamesjb.com>
6 ;;;
7 ;;; This code has been placed in the Public Domain. All warranties
8 ;;; are disclaimed.
9 ;;;
10 ;;; $Id: swank-loader.lisp,v 1.14 2004/01/19 20:15:19 lgorrie Exp $
11 ;;;
12
13 (cl:defpackage :swank-loader
14 (:use :common-lisp))
15
16 (in-package :swank-loader)
17
18 (defun make-swank-pathname (name &optional (type "lisp"))
19 "Return a pathname with name component NAME in the Slime directory."
20 (merge-pathnames name
21 (make-pathname
22 :type type
23 :directory
24 (pathname-directory
25 (or *compile-file-pathname* *load-pathname*
26 *default-pathname-defaults*)))))
27
28 (defparameter *sysdep-pathnames*
29 (mapcar #'make-swank-pathname
30 #+cmu '("swank-source-path-parser" "swank-cmucl")
31 #+sbcl '("swank-sbcl" "swank-source-path-parser" "swank-gray")
32 #+openmcl '("swank-openmcl" "swank-gray")
33 #+lispworks '("swank-lispworks" "swank-gray")
34 #+allegro '("swank-allegro" "swank-gray")
35 #+clisp '("xref" "swank-clisp" "swank-gray")
36 ))
37
38 (defparameter *swank-pathname* (make-swank-pathname "swank"))
39
40 (defun file-newer-p (new-file old-file)
41 "Returns true if NEW-FILE is newer than OLD-FILE."
42 (> (file-write-date new-file) (file-write-date old-file)))
43
44 (defun compile-files-if-needed-serially (files)
45 "Compile each file in FILES if the source is newer than
46 its corresponding binary, or the file preceding it was
47 recompiled."
48 (with-compilation-unit ()
49 (let ((needs-recompile nil))
50 (dolist (source-pathname files)
51 (let ((binary-pathname (compile-file-pathname source-pathname)))
52 (handler-case
53 (progn
54 (when (or needs-recompile
55 (not (probe-file binary-pathname))
56 (file-newer-p source-pathname binary-pathname))
57 (format t "~&;; Compiling ~A...~%" source-pathname)
58 (compile-file source-pathname)
59 (setq needs-recompile t))
60 (load binary-pathname))
61 #+(or)
62 (error ()
63 ;; If an error occurs compiling, load the source instead
64 ;; so we can try to debug it.
65 (load source-pathname))
66 ))))))
67
68 (defun user-init-file ()
69 "Return the name of the user init file or nil."
70 (probe-file
71 (merge-pathnames (user-homedir-pathname)
72 #-mswindows (make-pathname :name ".swank" :type "lisp")
73 #+mswindows (make-pathname :name "_swank" :type "lsp"))))
74
75 (compile-files-if-needed-serially
76 (list* (make-swank-pathname "swank-backend") *swank-pathname*
77 *sysdep-pathnames*))
78
79 (swank:warn-unimplemented-interfaces)
80
81 (when (user-init-file)
82 (load (user-init-file)))
83

  ViewVC Help
Powered by ViewVC 1.1.5