git.fiddlerwoaroof.com
Browse code

chore: make loadable with ASDF

Ed Langley authored on 29/10/2020 22:44:42
Showing 4 changed files
... ...
@@ -21,14 +21,8 @@
21 21
 (defparameter *kr-version* "2.3.4")
22 22
 
23 23
 (eval-when (:compile-toplevel :load-toplevel :execute)
24
-  (defvar *special-kr-optimization*
25
-    '(optimize
26
-      (speed 3)
27
-      #-allegro (safety 0) #+allegro (safety 1)
28
-      (space 0)
29
-      #-cmu (debug 0)
30
-      #+cmu (debug 0.5)
31
-      )))
24
+  (defparameter *special-kr-optimization*
25
+    '(optimize (speed 3) (safety 1) (space 0) (debug 0))))
32 26
 
33 27
 ;; This enables the eager-evaluation version.
34 28
 ;;  Currently turned off.
... ...
@@ -622,6 +616,9 @@
622 616
 
623 617
 ;; Moved type functions to kr.lisp (to get rid of free variable warnings).
624 618
 
619
+(define-condition kr-type-error (error)
620
+  ((%message :initarg :message :reader kr-type-error-message)))
621
+
625 622
 ;;; DEF-KR-TYPE
626 623
 ;;
627 624
 ;; Create a new type, which can then be used for typechecking.
... ...
@@ -644,17 +641,20 @@ You can also provide a documentation string as the last parameter, as in:
644 641
      (def-kr-type my-named-type () '(or keyword null) \"Sample doc string\")"
645 642
 
646 643
   (cond ((listp typename-or-type)
647
-	   (unless (eq (car typename-or-type) 'QUOTE)
648
-	     (error "Illegal typename to def-kr-type: ~S" typename-or-type))
649
-	   (unless (and (null args) (null body) (null type-doc))
650
-	     (error "Illegal specification: (DEF-KR-TYPE ~S ~S ~S ~S)"
651
-			typename-or-type args body type-doc))
652
-	   (setq body typename-or-type)
653
-	   (setq typename-or-type NIL))
644
+         (unless (eq (car typename-or-type) 'QUOTE)
645
+           (error 'kr-type-error
646
+                  :message (format nil "Illegal typename to def-kr-type: ~S" typename-or-type)))
647
+         (unless (and (null args) (null body) (null type-doc))
648
+           (error 'kr-type-error
649
+                  :message (format nil "Illegal specification: (DEF-KR-TYPE ~S ~S ~S ~S)"
650
+                                   typename-or-type args body type-doc)))
651
+         (setq body typename-or-type)
652
+         (setq typename-or-type NIL))
654 653
         (args
655
-	   (error "DEF-KR-TYPE only works with NULL args, not ~S~%" args))
654
+         (error 'kr-type-error
655
+                :message (format nil "DEF-KR-TYPE only works with NULL args, not ~S~%" args)))
656 656
         (T
657
-	   (setq typename-or-type (symbol-name typename-or-type))))
657
+         (setq typename-or-type (symbol-name typename-or-type))))
658 658
   (setq body (eval body))
659 659
   `(add-new-type ,typename-or-type ',body ,(type-to-fn body) ,type-doc))
660 660
 
... ...
@@ -1,8 +1,8 @@
1 1
 (in-package :cl-user)
2 2
 
3
-(defpackage :garnet-utils
3
+(defpackage :fwoar.garnet-utils
4 4
   (:use :common-lisp)
5
-  (:nicknames :gu)
5
+  (:nicknames :fw.gu)
6 6
   (:export *garnet-break-key*
7 7
            2pi -2pi
8 8
            add-to-list
... ...
@@ -24,11 +24,12 @@
24 24
            white
25 25
            while))
26 26
 
27
-(defpackage :kr-debug
27
+(defpackage :fwoar.kr-debug
28 28
   (:use :common-lisp))
29 29
 
30
-(defpackage :kr
31
-  (:use :common-lisp :kr-debug)
30
+(defpackage :fwoar.kr
31
+  (:use :common-lisp :fwoar.kr-debug)
32
+  (:nicknames :kr)
32 33
   (:export schema
33 34
            create-instance
34 35
            create-prototype
... ...
@@ -10,7 +10,7 @@
10 10
 
11 11
 ;; Host of Lisp utilities used by other Garnet code.
12 12
 
13
-(in-package :garnet-utils)
13
+(in-package :fwoar.garnet-utils)
14 14
 
15 15
 (defvar *debug-utils-mode* t)
16 16
 
... ...
@@ -1,5 +1,5 @@
1 1
 
2
-(in-package :garnet-utils)
2
+(in-package :fwoar.garnet-utils)
3 3
 
4 4
 (defvar black nil)
5 5
 (defvar white nil)