doc/list-exports.lisp: Strip duplicate exports.
[sod] / doc / list-exports.lisp
index d566a1b..0c809ee 100644 (file)
 
 (defmethod form-list-exports ((head (eql 'definst)) tail)
   (destructuring-bind (code (streamvar &key export) args &body body) tail
-    (declare (ignore streamvar args body))
+    (declare (ignore streamvar body))
     (and export
-        (list (symbolicate code '-inst)
-              (symbolicate 'make- code '-inst)))))
+        (list* (symbolicate code '-inst)
+               (symbolicate 'make- code '-inst)
+               (mapcar (lambda (arg)
+                         (symbolicate 'inst- arg))
+                       args)))))
 
 (defmethod form-list-exports ((head (eql 'define-tagged-type)) tail)
   (destructuring-bind (kind what) tail
@@ -34,6 +37,9 @@
 (defmethod form-list-exports ((head (eql 'macrolet)) tail)
   (mapcan #'form-exports (cdr tail)))
 
+(defmethod form-list-exports ((head (eql 'eval-when)) tail)
+  (mapcan #'form-exports (cdr tail)))
+
 (defmethod form-list-exports ((head (eql 'progn)) tail)
   (mapcan #'form-exports tail))
 
 (defun categorize-symbols (paths package)
   (mapcar (lambda (assoc)
            (let ((home (car assoc))
-                 (symbols (sort (mapcan (lambda (sym)
-                                          (multiple-value-bind
-                                              (symbol foundp)
-                                              (find-symbol (symbol-name sym)
-                                                           package)
-                                            (and foundp (list symbol))))
-                                        (cdr assoc))
-                                #'string< :key #'symbol-name)))
+                 (symbols (delete-duplicates
+                           (sort (mapcan (lambda (sym)
+                                           (multiple-value-bind
+                                               (symbol foundp)
+                                               (find-symbol
+                                                (symbol-name sym)
+                                                package)
+                                             (and foundp (list symbol))))
+                                         (cdr assoc))
+                                 #'string< :key #'symbol-name))))
              (cons home (mapcar (lambda (symbol)
                                   (cons symbol (categorize symbol)))
                                 symbols))))
   (let* ((pkg (symbol-package symbol))
         (exportp (member symbol (list-exported-symbols pkg))))
     (format nil "~(~:[~A:~:[:~;~]~;~2*~]~A~)"
-           (and exportp (eq pkg package)) (best-package-name pkg)
+           (and exportp (eq pkg package))
+           (if (keywordp symbol) "" (best-package-name pkg))
            exportp (symbol-name symbol))))
 
 (defun analyse-classes (package)
                                                     package))
                               (remove super
                                       (sb-mop:class-direct-superclasses this))))
-              (dolist (sub (reverse (gethash this subs)))
+              (dolist (sub (sort (copy-list (gethash this subs))
+                                 #'string< :key #'class-name))
                 (walk-down sub this (1+ depth)))))
       (walk-down (find-class t) nil 0))))
 
                  (pretty-symbol-name sym package)
                  (cdr def))))
       (terpri)))
+  (format t "Classes:~%")
   (analyse-classes package)
   (terpri))
 
   (labels ((components (comp)
             (slot-value comp 'asdf::components))
           (files (comp)
-            (remove-if-not (lambda (comp)
+            (sort (remove-if-not (lambda (comp)
                              (typep comp 'asdf:cl-source-file))
-                           (components comp)))
+                                 (components comp))
+                  #'string< :key #'asdf:component-name))
           (by-name (comp name)
             (find name (components comp)
                   :test #'string= :key #'asdf:component-name))