Mercurial > core / lisp/lib/doc/system.lisp
changeset 698: |
96958d3eb5b0 |
parent: |
c0fc6b87557f
|
author: |
Richard Westhaver <ellis@rwest.io> |
date: |
Fri, 04 Oct 2024 22:04:59 -0400 |
permissions: |
-rw-r--r-- |
description: |
fixes |
1 ;;; lib/doc/system.lisp --- System Documentation 3 ;; Documentation support for a Lisp System 8 (defclass system-documentation () 9 ((system :initarg :system :type system :accessor doc-system))) 11 (defun system-documentation (system) 12 "Return the SYSTEM-DOCUMENTATION for a specified SYSTEM." 13 (let ((s (find-system system))) 14 (make-instance 'system-documentation 17 (defmethod print-object ((self system-documentation) stream) 18 (with-slots (system) self 19 (print-unreadable-object (self stream :type t) 20 (format stream "~A" (component-name system))))) 22 (defmethod doc-files ((self system-documentation)) 23 "Return a list of source file components from SELF." 24 (flet ((%rec (s) (if (typep s 'asdf:module) 26 (component-pathname s)))) 27 (flatten (mapcar #'%rec (component-children (doc-system self)))))) 29 (defmethod doc-files ((self asdf:module)) 30 (flet ((%rec (s) (if (typep s 'asdf:module) 32 (component-pathname s)))) 33 (mapcar #'%rec (component-children self)))) 35 ;; TODO: to do this correctly we need to also check if SELF is a 36 ;; prefix of a different system name. e.g. "DOC" and "DOC-UTILS" 38 ;; TODO: system separator handling and optimizations 39 (defmethod doc-packages ((self system-documentation)) 40 "Return a list of packages which can be traced back to SELF. This 41 method will only return packages that are prefixed with the name of 43 ;; (asdf:component-loaded-p 44 (let ((s (component-name (doc-system self)))) 46 #'package-documentation 50 (when (and (packagep p) (string-prefix-p (string-upcase s) (package-name p))) 52 (list-all-packages)))))) 54 (defmethod doc-dependencies ((self system-documentation)) 55 (mapcar #'system-documentation (system-depends-on (doc-system self)))) 57 (defun find-system-dependents (system) 58 "Return a list of systems which depend on SYSTEM by iterating over ASDF:REGISTER-SYSTEMS." 60 (dolist (s (asdf:registered-systems)) 61 (setf s (find-system s)) 62 (when (and s (member (component-name system) 66 (string-downcase (format nil "~A" dep)))) 67 (asdf:system-depends-on s)) 72 (defmethod doc-dependents ((self system-documentation)) 73 (mapcar #'system-documentation (find-system-dependents (doc-system self))))