fix cxx generic function documentation generation
Sun Apr 12 22:25:47 CEST 2009 Tobias Rautenkranz <tobias@rautenkranz.ch>
* fix cxx generic function documentation generation
diff -rN -u old-smoke/src/objects/method.lisp new-smoke/src/objects/method.lisp
--- old-smoke/src/objects/method.lisp 2014-09-28 09:40:03.000000000 +0200
+++ new-smoke/src/objects/method.lisp 2014-09-28 09:40:03.000000000 +0200
@@ -166,14 +166,14 @@
(defun map-methods (function smoke)
"Applys FUNCTION to the methods of SMOKE.
The method argument to function must not be modified."
+ (declare (function function)
+ (cffi:foreign-pointer smoke)
+ (optimize (speed 3)))
(let ((method (make-instance 'smoke-method
:id 0
- :smoke smoke)))
- (loop for id from 1 to (1- (smoke-methods-size smoke)) do
- (when (= (mod id (floor (smoke-methods-size smoke) 10)) 0)
- (format t "[ ~A ]~%" (* 10
- (floor (* 10 id)
- (smoke-methods-size smoke)))))
+ :smoke smoke))
+ (length (1- (the fixnum (smoke-methods-size smoke)))))
+ (loop for id from 1 to length do
(setf (slot-value method 'id) id)
(funcall function method))))
diff -rN -u old-smoke/src/smoke.lisp new-smoke/src/smoke.lisp
--- old-smoke/src/smoke.lisp 2014-09-28 09:40:03.000000000 +0200
+++ new-smoke/src/smoke.lisp 2014-09-28 09:40:03.000000000 +0200
@@ -98,10 +98,14 @@
method-name
args))
-(defmethod documentation ((class smoke-standard-class) (doc-type t))
+(defmethod documentation ((class smoke-standard-class) (doc-type (eql 't)))
+ (declare (optimize (speed 3)))
(format nil "~@[~A~%~]C++ name: ~A" (call-next-method) (name class)))
-(defmethod documentation ((gf smoke-gf) (doc-type t))
+;; No eql T since all-methods is to slow to be used in conjunction with
+;; mb:document
+(defmethod documentation ((gf smoke-gf) (doc-type (eql 'cxx-function)))
+ (declare (optimize (speed 3)))
(let ((methods (all-methods (name gf))))
(format nil "~@[~A~%~]~{~T~A~%~}"
(call-next-method)
@@ -109,6 +113,9 @@
(defun all-methods (name)
"Returns a list of all methods named NAME."
+ ;;FIXME speed this up, needed by (mb:document :smoke).
+ (declare (string name)
+ (optimize (speed 3)))
(let ((methods))
(maphash #'(lambda (address value)
(declare (ignore value))