Added some more defgeneric.

Pascal J. Bourguignon [2013-06-23 22:08]
Added some more defgeneric.
Filename
clext/closer-weak.lisp
diff --git a/clext/closer-weak.lisp b/clext/closer-weak.lisp
index 94fa5b5..6f65f8b 100644
--- a/clext/closer-weak.lisp
+++ b/clext/closer-weak.lisp
@@ -702,6 +702,8 @@ It has no effect when some key has already been garbage-collected.")
          :finally (return-from :assoc nil))))

 #-(and clisp (not debug-weak))
+(defgeneric weak-alist-remove-assoc (item weak-alist &key test test-not key))
+#-(and clisp (not debug-weak))
 (defmethod weak-alist-remove-assoc (item (self weak-alist)
                                     &key (test (function eql))
                                     (test-not nil) (key (function identity)))
@@ -721,6 +723,8 @@ It has no effect when some key has already been garbage-collected.")
          :finally (return-from :assoc nil))))

 #-(and clisp (not debug-weak))
+(defgeneric weak-alist-rassoc (item weak-alist &key test test-not key))
+#-(and clisp (not debug-weak))
 (defmethod weak-alist-rassoc (item (self weak-alist) &key (test (function eql))
                               (test-not nil) (key (function identity)))
   (if test-not
@@ -736,11 +740,15 @@ It has no effect when some key has already been garbage-collected.")
          :finally (return-from :assoc nil))))

 #-(and clisp (not debug-weak))
+(defgeneric weak-alist-value (item weak-alist &key test test-not))
+#-(and clisp (not debug-weak))
 (defmethod weak-alist-value (item (self weak-alist)
                              &key (test (function eql)) (test-not nil))
   (cdr (weak-alist-assoc item self :test test :test-not test-not)))

 #-(and clisp (not debug-weak))
+(defgeneric (setf weak-alist-value) (value item weak-alist &key test test-not))
+#-(and clisp (not debug-weak))
 (defmethod (setf weak-alist-value) (value item (self weak-alist)
                                     &key (test (function eql)) (test-not nil))
   (if test-not
@@ -813,7 +821,8 @@ It has no effect when some key has already been garbage-collected.")
     (maphash (lambda (k v) (declare (ignore k v)) (incf count)) self)
     count))

-
+#-(and (or ccl clisp) (not debug-weak))
+(defgeneric dump-wht (weak-hash-table &optional out))
 #-(and (or ccl clisp) (not debug-weak))
 (defmethod dump-wht ((self weak-hash-table) &optional (out *standard-output*))
   (format out "~A~%" (class-name (class-of self)))
@@ -885,6 +894,8 @@ It has no effect when some key has already been garbage-collected.")
   (array-dimension (wht-buckets self) 0))

 #-(and (or ccl clisp) (not debug-weak))
+(defgeneric wht-iterator (weak-hash-table))
+#-(and (or ccl clisp) (not debug-weak))
 (defmethod wht-iterator ((self weak-hash-table))
   (let ((current-bucket 0)
         (current-pairs  nil))
@@ -909,6 +920,8 @@ It has no effect when some key has already been garbage-collected.")
                         (values nil nil nil)))))))

 #-(and (or ccl clisp) (not debug-weak))
+(defgeneric %rehash-table (weak-hash-table new-size))
+#-(and (or ccl clisp) (not debug-weak))
 (defmethod %rehash-table ((self weak-hash-table) new-size)
   (let ((new (make-hash-table
               :weak             (wht-pair-type self)
@@ -921,6 +934,8 @@ It has no effect when some key has already been garbage-collected.")
     self))

 #-(and (or ccl clisp) (not debug-weak))
+(defgeneric check-reduce-size (weak-hash-table result-values))
+#-(and (or ccl clisp) (not debug-weak))
 (defmethod check-reduce-size ((self weak-hash-table) result-values)
   (let ((threshold-count (truncate (hash-table-size self)
                                    (hash-table-rehash-threshold self))))
@@ -933,6 +948,8 @@ It has no effect when some key has already been garbage-collected.")
   (values-list result-values))

 #-(and (or ccl clisp) (not debug-weak))
+(defgeneric check-increase-size (self weak-hash-table result-values))
+#-(and (or ccl clisp) (not debug-weak))
 (defmethod check-increase-size ((self weak-hash-table) result-values)
   (let ((threshold-count  (* (hash-table-size self)
                              (hash-table-rehash-threshold self))))
ViewGit