Skip to content

Commit

Permalink
* swank-backend.lisp (swank-compile-file): Take output-file as
Browse files Browse the repository at this point in the history
additional argument.  Update backends accordingly.

* swank.lisp (*fasl-directory*): New variable.
(fasl-pathname): New function.
(compile-file-for-emacs): Use it.
  • Loading branch information
Helmut Eller committed Jan 10, 2009
1 parent 01ce2bc commit f761f28
Show file tree
Hide file tree
Showing 13 changed files with 73 additions and 33 deletions.
10 changes: 10 additions & 0 deletions ChangeLog
Expand Up @@ -2,9 +2,19 @@

* swank.lisp (do-symbols*): Wrap body in TAGBODY.

2009-01-10 Helmut Eller <heller@common-lisp.net>

* swank-backend.lisp (swank-compile-file): Take output-file as
additional argument. Update backends accordingly.

* swank.lisp (*fasl-directory*): New variable.
(fasl-pathname): New function.
(compile-file-for-emacs): Use it.

2009-01-10 Helmut Eller <heller@common-lisp.net>

* swank-backend.lisp (set-default-initial-binding): New function.

* swank.lisp (setup-stream-indirection): Use it

2009-01-09 Helmut Eller <heller@common-lisp.net>
Expand Down
8 changes: 5 additions & 3 deletions swank-abcl.lisp
Expand Up @@ -327,14 +327,16 @@

(defvar *abcl-signaled-conditions*)

(defimplementation swank-compile-file (filename load-p external-format)
(defimplementation swank-compile-file (input-file output-file
load-p external-format)
(declare (ignore external-format))
(let ((jvm::*resignal-compiler-warnings* t)
(*abcl-signaled-conditions* nil))
(handler-bind ((warning #'handle-compiler-warning))
(let ((*buffer-name* nil)
(*compile-filename* filename))
(multiple-value-bind (fn warn fail) (compile-file filename)
(*compile-filename* input-file))
(multiple-value-bind (fn warn fail)
(compile-file input-file :output-file output-file)
(values fn warn
(or fail
(and load-p
Expand Down
9 changes: 6 additions & 3 deletions swank-allegro.lisp
Expand Up @@ -285,11 +285,14 @@
)
(funcall function)))

(defimplementation swank-compile-file (filename load-p external-format)
(defimplementation swank-compile-file (input-file output-file
load-p external-format)
(with-compilation-hooks ()
(let ((*buffer-name* nil)
(*compile-filename* filename))
(compile-file *compile-filename* :load-after-compile load-p
(*compile-filename* input-file))
(compile-file *compile-filename*
:output-file output-file
:load-after-compile load-p
:external-format external-format))))

(defun call-with-temp-file (fn)
Expand Down
5 changes: 3 additions & 2 deletions swank-backend.lisp
Expand Up @@ -392,8 +392,9 @@ value.
Should return T on successfull compilation, NIL otherwise.
")

(definterface swank-compile-file (pathname load-p external-format)
"Compile PATHNAME signalling COMPILE-CONDITIONs.
(definterface swank-compile-file (input-file output-file load-p
external-format)
"Compile INPUT-FILE signalling COMPILE-CONDITIONs.
If LOAD-P is true, load the file after compilation.
EXTERNAL-FORMAT is a value returned by find-external-format or
:default.
Expand Down
7 changes: 5 additions & 2 deletions swank-clisp.lisp
Expand Up @@ -625,11 +625,14 @@ Execute BODY with NAME's function slot set to FUNCTION."
:message (princ-to-string condition)
:location (compiler-note-location))))

(defimplementation swank-compile-file (filename load-p external-format)
(defimplementation swank-compile-file (input-file output-file
load-p external-format)
(with-compilation-hooks ()
(with-compilation-unit ()
(multiple-value-bind (fasl-file warningsp failurep)
(compile-file filename :external-format external-format)
(compile-file input-file
:output-file output-file
:external-format external-format)
(values fasl-file warningsp
(or failurep
(and load-p
Expand Down
10 changes: 6 additions & 4 deletions swank-cmucl.lisp
Expand Up @@ -379,19 +379,21 @@ NIL if we aren't compiling from a buffer.")
(c::warning #'handle-notification-condition))
(funcall function))))

(defimplementation swank-compile-file (filename load-p external-format)
(defimplementation swank-compile-file (input-file output-file
load-p external-format)
(declare (ignore external-format))
(clear-xref-info filename)
(clear-xref-info input-file)
(with-compilation-hooks ()
(let ((*buffer-name* nil)
(ext:*ignore-extra-close-parentheses* nil))
(multiple-value-bind (output-file warnings-p failure-p)
(compile-file filename)
(compile-file input-file :output-file output-file)
(values output-file warnings-p
(or failure-p
(when load-p
;; Cache the latest source file for definition-finding.
(source-cache-get filename (file-write-date filename))
(source-cache-get input-file
(file-write-date input-file))
(not (load output-file)))))))))

(defimplementation swank-compile-string (string &key buffer position filename
Expand Down
9 changes: 5 additions & 4 deletions swank-corman.lisp
Expand Up @@ -361,13 +361,14 @@
(list :error "No location"))))))))
(funcall fn)))

(defimplementation swank-compile-file (*compile-filename* load-p
external-format)
(defimplementation swank-compile-file (input-file output-file
load-p external-format)
(declare (ignore external-format))
(with-compilation-hooks ()
(let ((*buffer-name* nil))
(let ((*buffer-name* nil)
(*compile-filename* input-file))
(multiple-value-bind (output-file warnings? failure?)
(compile-file *compile-filename*)
(compile-file input-file :output-file output-file)
(values output-file warnings?
(or failure? (and load-p (load output-file))))))))

Expand Down
9 changes: 5 additions & 4 deletions swank-ecl.lisp
Expand Up @@ -138,12 +138,13 @@
(handler-bind ((warning #'handle-compiler-warning))
(funcall function)))

(defimplementation swank-compile-file (*compile-filename* load-p
external-format)
(defimplementation swank-compile-file (input-file output-file
load-p external-format)
(declare (ignore external-format))
(with-compilation-hooks ()
(let ((*buffer-name* nil))
(compile-file *compile-filename* :load t))))
(let ((*buffer-name* nil)
(*compile-filename* input-file))
(compile-file input-file :output-file output-file :load t))))

(defimplementation swank-compile-string (string &key buffer position filename
policy)
Expand Down
9 changes: 6 additions & 3 deletions swank-lispworks.lisp
Expand Up @@ -426,9 +426,12 @@ Return NIL if the symbol is unbound."
(signal-undefined-functions compiler::*unknown-functions*
,location))))))

(defimplementation swank-compile-file (filename load-p external-format)
(with-swank-compilation-unit (filename)
(compile-file filename :load load-p
(defimplementation swank-compile-file (input-file output-file
load-p external-format)
(with-swank-compilation-unit (input-file)
(compile-file input-file
:output-file output-file
:load load-p
:external-format external-format)))

(defvar *within-call-with-compilation-hooks* nil
Expand Down
7 changes: 5 additions & 2 deletions swank-openmcl.lisp
Expand Up @@ -261,12 +261,15 @@ condition."
(handler-bind ((ccl::compiler-warning 'handle-compiler-warning))
(funcall function)))

(defimplementation swank-compile-file (filename load-p external-format)
(defimplementation swank-compile-file (input-file output-file
load-p external-format)
(declare (ignore external-format))
(with-compilation-hooks ()
(let ((*buffer-name* nil)
(*buffer-offset* nil))
(compile-file filename :load load-p))))
(compile-file input-file
:output-file output-file
:load load-p))))

(defimplementation frame-var-value (frame var)
(block frame-var-value
Expand Down
9 changes: 6 additions & 3 deletions swank-sbcl.lisp
Expand Up @@ -485,16 +485,19 @@ compiler state."

(defvar *trap-load-time-warnings* nil)

(defimplementation swank-compile-file (pathname load-p external-format)
(defimplementation swank-compile-file (input-file output-file
load-p external-format)
(handler-case
(multiple-value-bind (output-file warnings-p failure-p)
(with-compilation-hooks ()
(compile-file pathname :external-format external-format))
(compile-file input-file :output-file output-file
:external-format external-format))
(values output-file warnings-p
(or failure-p
(when load-p
;; Cache the latest source file for definition-finding.
(source-cache-get pathname (file-write-date pathname))
(source-cache-get input-file
(file-write-date input-file))
(not (load output-file))))))
(sb-c:fatal-compiler-error () nil)))

Expand Down
10 changes: 7 additions & 3 deletions swank-scl.lisp
Expand Up @@ -438,17 +438,21 @@
(c::warning #'handle-notification-condition))
(funcall function))))

(defimplementation swank-compile-file (filename load-p external-format)
(defimplementation swank-compile-file (input-file output-file
load-p external-format)
(with-compilation-hooks ()
(let ((*buffer-name* nil)
(ext:*ignore-extra-close-parentheses* nil))
(multiple-value-bind (output-file warnings-p failure-p)
(compile-file filename :external-format external-format)
(compile-file input-file
:output-file output-file
:external-format external-format)
(values output-file warnings-p
(or failure-p
(when load-p
;; Cache the latest source file for definition-finding.
(source-cache-get filename (file-write-date filename))
(source-cache-get input-file
(file-write-date input-file))
(not (load output-file)))))))))

(defimplementation swank-compile-string (string &key buffer position filename
Expand Down
4 changes: 4 additions & 0 deletions swank.lisp
Expand Up @@ -2756,6 +2756,10 @@ Record compiler notes signalled as `compiler-condition's."
(t
(compile-file-pathname input-file))))

(pathname-to-filename
(compile-file-pathname "y.lisp"
:output-file (filename-to-pathname "/tmp/x/")))

(defslimefun compile-string-for-emacs (string buffer position filename policy)
"Compile STRING (exerpted from BUFFER at POSITION).
Record compiler notes signalled as `compiler-condition's."
Expand Down

0 comments on commit f761f28

Please sign in to comment.