add function X:CHECK-RECOMPILE, to automatically recompile "slime/thread-safe.lisp" on every version change (ECL/Qt5/EQL5)

This commit is contained in:
polos 2017-02-17 11:32:51 +01:00
parent 26e218d29e
commit 1f880635e4
9 changed files with 24 additions and 24 deletions

1
.gitignore vendored
View file

@ -3,6 +3,7 @@
*.dylib
*.exe
*.fas*
*.ver
*.*history
*.lib
*.o

View file

@ -2,7 +2,6 @@ REBUILD STEPS (on every upgrade of: ECL, Qt, EQL)
=============
1) remove directory src/tmp/
remove file slime/thread-safe.fas*
remove file src/lisp/ecl-readline.fas*
2) ecl -shell make-eql-lib.lisp

View file

@ -46,7 +46,6 @@
<p>To kill the swank process (Slime), use function <code>qquit</code> / <code>qq</code> (since quitting Emacs will not kill it).</p>
<br>
<h3>Notes</h3>
<p>Please note that you need to manually <b>delete</b> the file <code>eql5/slime/thread-safe.fas*</code> after every upgrade of either ECL or EQL (it will then be compiled automatically next time you use Slime).</p>
<p>All EQL functions are wrapped in <code>qrun*</code> (see <code>eql5/slime/thread-safe.lisp</code>), so it's safe to call them either directly from the REPL or using 'eval region' (or from any other ECL thread).</p>
<p>If the Slime REPL hangs, you can simply try to connect again (losing the old connection): no need to restart Lisp.</p>
<p>This Slime mode is both convenient and simple to use, but conses a little more for every EQL function call.

View file

@ -743,11 +743,11 @@
;; package :x
"bytes-to-string"
"cc"
"check-recompile"
"d"
"do-string"
"do-with"
"empty-string"
"ensure-compiled"
"ensure-list"
"ends-with"
"it"

View file

@ -1,5 +0,0 @@
Please note that you need to delete "thread-safe.fas*" manually
on every upgrade of either ECL or EQL.
It will then be compiled automatically next time you use Slime.

View file

@ -7,7 +7,7 @@
#include <QTimer>
#include <QStringList>
const char EQL::version[] = "17.2.7"; // Feb 2017
const char EQL::version[] = "17.2.8"; // Feb 2017
extern "C" void ini_EQL(cl_object);

View file

@ -316,7 +316,7 @@
(find-symbol "*SLIME-REPL-EVAL-HOOKS*" :swank))
(load (or *slime-hook-file* (in-home "slime/repl-hook"))) ; Slime mode "REPL hook"
(qsingle-shot 500 'load-slime-auxiliary-file)) ; we need to wait for Emacs "slime-connect"
(load (x:ensure-compiled (in-home "slime/thread-safe"))))) ; Slime mode "thread safe" (default)
(load (x:check-recompile (in-home "slime/thread-safe"))))) ; Slime mode "thread safe" (default)
#+threads
(defun %read-thread ()

View file

@ -4,12 +4,12 @@
(:use :common-lisp)
(:export
#:cc
#:check-recompile
#:bytes-to-string
#:d
#:do-string
#:do-with
#:empty-string
#:ensure-compiled
#:ensure-list
#:ends-with
#:it
@ -148,18 +148,6 @@
(defun string-to-bytes (s)
(map 'vector 'char-code s))
(defun ensure-compiled (file-name)
"Expects file name without file ending, and returns (re-)compiled file name."
(let ((lisp (concatenate 'string file-name ".lisp"))
(fasl (concatenate 'string file-name ".fas*"))) ; for *.fas, *.fasb, *.fasc (Unix, Windows)
(flet ((compiled ()
(first (directory fasl))))
(unless (and (compiled)
(>= (file-write-date (compiled))
(file-write-date lisp)))
(compile-file lisp))
(compiled))))
(defun path (name)
"Needed because ECL uses base strings (not Unicode) for pathnames internally."
#+(or darwin linux)
@ -169,3 +157,22 @@
(funcall (intern "QLOCAL8BIT" :eql) name) ; Windows 7 and lower
name)) ; Windows 8 and higher
(defun check-recompile (file-name)
"Given a global file name without file ending, ensures re-compiling on every EQL5 or Qt5 version change."
(labels ((ver-name ()
(format nil "~A.ver" file-name))
(version ()
(multiple-value-bind (eql5 qt5)
(funcall (find-symbol "QVERSION" :eql))
(format nil "EQL5 ~A (ECL ~A, Qt ~A)" eql5 (lisp-implementation-version) qt5)))
(write-version ()
(with-open-file (s (ver-name) :direction :output :if-exists :supersede)
(princ (version) s)))
(read-version ()
(x:when-it (probe-file (ver-name))
(with-open-file (s x:it :direction :input)
(read-line s)))))
(unless (equal (version) (read-version))
(compile-file file-name)
(write-version)))
file-name)

View file

@ -1,7 +1,6 @@
rm -fr tmp
rm *.a
rm lisp/*.o
rm ../slime/thread-safe.fas*
cd lisp
ecl -compile ecl-readline.lisp