Browse code
chore: maintain ASDF system
Ed Langley authored on 27/10/2019 04:14:52
Showing 2 changed files
Showing 2 changed files
... | ... |
@@ -11,39 +11,69 @@ |
11 | 11 |
:package :fwoar.string-utils)) |
12 | 12 |
:depends-on (#:anaphora |
13 | 13 |
#:alexandria |
14 |
- #:serapeum |
|
15 | 14 |
#:cl-containers |
15 |
+ #:closer-mop |
|
16 | 16 |
#:iterate |
17 |
+ #:fwoar-lisputils/patmatch |
|
17 | 18 |
#:fwoar-lisputils/string-utils |
18 |
- #-lispworks #:plump |
|
19 |
+ #:plump |
|
19 | 20 |
#:positional-lambda |
20 |
- #-lispworks #:should-test) |
|
21 |
+ (:feature (:not (:or :ecl :abcl)) |
|
22 |
+ #:fwoar-lisputils/implementation-dependent)) |
|
21 | 23 |
:components ((:file "package") |
22 | 24 |
(:file "fwoar-lisputils") |
23 |
- (:file "lexical-compare") |
|
24 | 25 |
(:file "hash-functions") |
25 | 26 |
(:file "multiple-values") |
26 |
- (:file "clos-helpers") |
|
27 |
+ (:file "restarts") |
|
27 | 28 |
(:file "counter") |
28 | 29 |
(:file "vector-utils") |
29 |
- #-lispworks |
|
30 |
- (:file "non-lispworks") |
|
31 |
- #-lispworks |
|
32 |
- (:file "patmatch") |
|
30 |
+ (:file "html") |
|
33 | 31 |
(:file "glambda") |
34 |
- (:file "misc"))) |
|
32 |
+ (:file "misc") |
|
33 |
+ )) |
|
34 |
+ |
|
35 |
+(defsystem :fwoar-lisputils/implementation-dependent |
|
36 |
+ :description "Utilities that don't work on every system" |
|
37 |
+ :author "fiddlerwoaroof <fiddlerwoaroof@gmail.com" |
|
38 |
+ :license "MIT" |
|
39 |
+ :serial t |
|
40 |
+ :depends-on () |
|
41 |
+ :components ((:file "non-ecl" :if-feature (:not (:or :ecl :abcl))) |
|
42 |
+ (:file "lexical-compare" :if-feature (:not (:or :ecl :abcl))) |
|
43 |
+ (:file "clos-helpers" :if-feature (:not (:or :ecl :abcl))))) |
|
44 |
+ |
|
45 |
+(defsystem :fwoar-lisputils/patmatch |
|
46 |
+ :description "" |
|
47 |
+ :author "Ed L <edward@elangley.org>" |
|
48 |
+ :license "MIT" |
|
49 |
+ :depends-on (#:alexandria |
|
50 |
+ #:uiop) |
|
51 |
+ :serial t |
|
52 |
+ :components ((:module "patmatch" |
|
53 |
+ :components ((:file "package") |
|
54 |
+ (:file "patmatch" :depends-on ("package")))))) |
|
55 |
+ |
|
56 |
+(defsystem :fwoar-lisputils/patmatch/test |
|
57 |
+ :description "" |
|
58 |
+ :author "Ed L <edward@elangley.org>" |
|
59 |
+ :license "MIT" |
|
60 |
+ :depends-on (:fwoar-lisputils/patmatch |
|
61 |
+ :parachute) |
|
62 |
+ :serial t |
|
63 |
+ :components ((:module "patmatch" |
|
64 |
+ :components ((:file "test"))))) |
|
35 | 65 |
|
36 | 66 |
(defsystem #:fwoar-lisputils/string-utils |
37 | 67 |
:description "A string splitter" |
38 | 68 |
:author "fiddlerwoaroof <fiddlerwoaroof@gmail.com" |
39 | 69 |
:license "MIT" |
40 |
- :depends-on (#:should-test) |
|
70 |
+ :depends-on () |
|
41 | 71 |
:components ((:file "string-utils/package") |
42 | 72 |
(:file "string-utils/split" |
43 | 73 |
:depends-on ("string-utils/package")) |
44 | 74 |
(:file "string-utils/string-utils" |
45 | 75 |
:depends-on ("string-utils/package")) |
46 |
- #-lispworks |
|
76 |
+ #+(or) |
|
47 | 77 |
(:file "string-utils/test" :depends-on ("string-utils/string-utils")))) |
48 | 78 |
|
49 | 79 |
(asdf:defsystem #:fwoar-lisputils/swank-utils |
50 | 80 |
deleted file mode 100644 |
... | ... |
@@ -1,149 +0,0 @@ |
1 |
-(in-package :patmatch) |
|
2 |
- |
|
3 |
-(define-condition no-pattern (error) |
|
4 |
- ((%pattern-obj :initarg :pattern-obj :reader pattern-obj) |
|
5 |
- (%pattern-form :initarg :pattern-form :reader pattern-form) |
|
6 |
- (%pattern-args :initarg :pattern-args :reader pattern-args))) |
|
7 |
- |
|
8 |
-(eval-when (:compile-toplevel :load-toplevel :execute) |
|
9 |
- (defgeneric handle-pattern (pattern form &rest args) |
|
10 |
- (:method-combination append) |
|
11 |
- |
|
12 |
- (:method append ((pattern (eql 'cons)) form &rest args) |
|
13 |
- (let ((val-sym (gensym "VAL"))) |
|
14 |
- (destructuring-bind (car cdr) args |
|
15 |
- `((,val-sym ,form) |
|
16 |
- (,car (car ,val-sym)) |
|
17 |
- (,cdr (cdr ,val-sym)))))) |
|
18 |
- |
|
19 |
- (:method append ((pattern (eql 'vector)) form &rest args) |
|
20 |
- (let ((val-sym (gensym "VAL"))) |
|
21 |
- `((,val-sym ,form) |
|
22 |
- ,@ (loop for arg in args |
|
23 |
- for idx from 0 |
|
24 |
- collect `(,arg (aref ,val-sym ,idx)))))) |
|
25 |
- |
|
26 |
- (:method append ((pattern (eql 'hash-table)) form &rest args) |
|
27 |
- (let* ((val-sym (gensym "VAL")) |
|
28 |
- (binding-forms (loop for (key sym) in args |
|
29 |
- append `((,sym (gethash ',key ,val-sym)))))) |
|
30 |
- `((,val-sym ,form) |
|
31 |
- ,@binding-forms))) |
|
32 |
- |
|
33 |
- (:method append ((pattern symbol) form &rest args) |
|
34 |
- (when (closer-mop:subclassp pattern 'standard-object) |
|
35 |
- (apply #'handle-pattern |
|
36 |
- (closer-mop:class-prototype |
|
37 |
- (closer-mop:ensure-finalized (find-class pattern))) |
|
38 |
- form |
|
39 |
- args))))) |
|
40 |
- |
|
41 |
-(defmacro let-pat* ((&rest clauses) &body body) |
|
42 |
- `(let* (,@ (loop for ((discriminator . args) val-form) in clauses |
|
43 |
- append (apply 'handle-pattern discriminator val-form args))) |
|
44 |
- ,@body)) |
|
45 |
- |
|
46 |
- |
|
47 |
-(defpackage :patmatch/test |
|
48 |
- (:use :cl :should-test) |
|
49 |
- (:import-from :patmatch :let-pat*) |
|
50 |
- (:export )) |
|
51 |
-(in-package :patmatch/test) |
|
52 |
- |
|
53 |
-#| |
|
54 |
-(deftest let-pat*-handles-cons () |
|
55 |
- "" |
|
56 |
- (should be eql |
|
57 |
- 2 |
|
58 |
- (let-pat* (((cons a b) '(2 . 3))) |
|
59 |
- (declare (ignore b)) |
|
60 |
- a)) |
|
61 |
- (should be eql |
|
62 |
- 3 |
|
63 |
- (let-pat* (((cons a b) '(2 . 3))) |
|
64 |
- (declare (ignore a)) |
|
65 |
- b))) |
|
66 |
- |
|
67 |
-(deftest let-pat*-handles-vector () |
|
68 |
- "" |
|
69 |
- (should be eql |
|
70 |
- 2 |
|
71 |
- (let-pat* (((vector a b) #(2 3))) |
|
72 |
- (declare (ignore b)) |
|
73 |
- a)) |
|
74 |
- (should be eql |
|
75 |
- 3 |
|
76 |
- (let-pat* (((vector a b) #(2 3))) |
|
77 |
- (declare (ignore a)) |
|
78 |
- b))) |
|
79 |
- |
|
80 |
-(deftest let-pat*-handles-hash-table () |
|
81 |
- "" |
|
82 |
- (should be eql |
|
83 |
- 2 |
|
84 |
- (let-pat* (((hash-table (:a a) (:b b)) (alexandria:plist-hash-table '(:a 2 :b 3)))) |
|
85 |
- (declare (ignore b)) |
|
86 |
- a)) |
|
87 |
- (should be eql |
|
88 |
- 3 |
|
89 |
- (let-pat* (((hash-table (:a a) (:b b)) (alexandria:plist-hash-table '(:a 2 :b 3)))) |
|
90 |
- (declare (ignore a)) |
|
91 |
- b))) |
|
92 |
- |
|
93 |
-(eval-when (:compile-toplevel :load-toplevel :execute) |
|
94 |
- (defclass test-base () |
|
95 |
- ((a :initform 1))) |
|
96 |
- (defclass test-sub1 (test-base) |
|
97 |
- ()) |
|
98 |
- (defclass test-sub2 (test-base) |
|
99 |
- ((b :initform 2))) |
|
100 |
- (closer-mop:ensure-class 'test-base) |
|
101 |
- (closer-mop:ensure-class 'test-sub1) |
|
102 |
- (closer-mop:ensure-class 'test-sub2) |
|
103 |
- ) |
|
104 |
- |
|
105 |
-(defmethod patmatch:handle-pattern append ((pattern test-base) form &rest args) |
|
106 |
- (alexandria:when-let ((arg (getf args :a))) |
|
107 |
- (let ((val-sym (gensym "test-base-"))) |
|
108 |
- `((,val-sym ,form) |
|
109 |
- ,@(serapeum:unsplice |
|
110 |
- `(,arg (slot-value ,val-sym 'a))))))) |
|
111 |
- |
|
112 |
-(defmethod patmatch:handle-pattern append ((pattern test-sub2) form &rest args) |
|
113 |
- (alexandria:when-let ((arg (getf args :b))) |
|
114 |
- (let ((val-sym (gensym "test-base-"))) |
|
115 |
- `((,val-sym ,form) |
|
116 |
- ,@(serapeum:unsplice |
|
117 |
- `(,arg (slot-value ,val-sym 'b))))))) |
|
118 |
- |
|
119 |
- |
|
120 |
-(deftest let-pat*-handles-object-destructuring () |
|
121 |
- "" |
|
122 |
- (should be eql |
|
123 |
- 1 |
|
124 |
- (let-pat* (((test-base :a a) (make-instance 'test-base))) |
|
125 |
- a))) |
|
126 |
- |
|
127 |
-(deftest let-pat*-handles-inheritance () |
|
128 |
- "" |
|
129 |
- (should be eql |
|
130 |
- 1 |
|
131 |
- (let-pat* (((test-base :a a) (make-instance 'test-sub1))) |
|
132 |
- a)) |
|
133 |
- |
|
134 |
- (should be eql |
|
135 |
- 1 |
|
136 |
- (let-pat* (((test-sub1 :a a) (make-instance 'test-sub1))) |
|
137 |
- a)) |
|
138 |
- |
|
139 |
- (should be eql |
|
140 |
- 1 |
|
141 |
- (let-pat* (((test-sub2 :a a) (make-instance 'test-sub2))) |
|
142 |
- a)) |
|
143 |
- |
|
144 |
- (should be equal |
|
145 |
- '(1 2) |
|
146 |
- (let-pat* (((test-sub2 :a a :b b) (make-instance 'test-sub2))) |
|
147 |
- (list a b)))) |
|
148 |
- |
|
149 |
-|# |