Mercurial > core / lisp/lib/doc/pkg.lisp
changeset 698: |
96958d3eb5b0 |
parent: |
1f065ead57ca
|
author: |
Richard Westhaver <ellis@rwest.io> |
date: |
Fri, 04 Oct 2024 22:04:59 -0400 |
permissions: |
-rw-r--r-- |
description: |
fixes |
1 ;;; lib/doc/pkg.lisp --- CL Documentation 3 ;; This package is designed to help us navigate our Lisp systems, 4 ;; packages, symbols, and files to extract information relevant to 5 ;; documentation. This is a rather broad category. Here are some of 6 ;; the categories of information we're interested in: 8 ;; - Comments :: like this one. 11 ;; - Docstrings :: typically store in symbol properties, documentation 12 ;; metaclass slot, etc. often found somewhere in the body of a form 15 ;; - Object Structure :: for functions - their declared type, for 16 ;; objects their slots, methods, sub/superclasses, allocation info, 19 ;; - Source :: the source code which defines a symbol and its 20 ;; file/line location. 24 ;; Documentation is a tricky craft, good thing we have a 25 ;; self-documenting language :). 27 ;; The API consists of extractors for the above categories of 28 ;; information and a compiler (in comp.lisp) which can be used to 29 ;; generate documentation output. 31 ;; This library DOES NOT implement export/publishing per se. We use 32 ;; the ORGAN system to generate ORG-DOCUMENT objects, which themselves 33 ;; implement the functionality needed to generate *.org files and 34 ;; translate to html,pdf,txt and other formats. 37 (eval-when (:compile-toplevel :load-toplevel) (require :sb-introspect)) 40 (:use :cl :std :organ :sb-mop :sb-introspect :obj/id :log) 41 (:import-from :uiop :string-prefix-p) 42 (:import-from :asdf :component-name :component-children 43 :system :component-pathname :find-system :system-description 45 (:import-from :sb-c :packed-info :symbol-hash :symbol-dbinfo :vop-p :package-external-symbol-count) 46 (:import-from :sb-kernel :symbol-package-id) 47 (:import-from :sb-ext :restrict-compiler-policy) 48 (:import-from :ql-dist :dist :find-dist :provided-systems :installed-systems) 49 (:import-from :sb-impl :print-standard-describe-header :describe-object) 50 (:import-from :sb-int :condition) 51 (:import-from :sb-alien :alien-type-p) 58 :doc-file :doc-files :doc-symbol :doc-symbols :doc-package :doc-packages :doc-dist 59 :doc-pathnames :doc-directories :doc-parse :doc-system :doc-dependencies :doc-dependents 61 :do-symbol* :classify-symbol :symbol-classification-string 64 :package-documentation 66 :define-source-file* :*source-file-types* 67 :file-heading :file-headline :file-header :read-file-header 68 :+max-heading-level+ :+min-heading-level+ 80 (defparameter *definition-types* 84 :symbol-macro define-symbol-macro 86 :compiler-macro define-compiler-macro 88 :generic-function defgeneric 90 :setf-expander define-setf-expander 92 :condition define-condition 94 :method-combination define-method-combination 96 :transform :deftransform 97 :optimizer :defoptimizer 99 :source-transform :define-source-transform 100 :ir1-convert :def-ir1-translator 102 :alien-type :define-alien-type) 103 "Map SB-INTROSPECT definition type names to Slime-friendly forms") 105 (defun definition-specifier (type) 106 "Return a pretty specifier for NAME representing a definition of type TYPE." 107 (getf *definition-types* type)) 109 (defun make-dspec (type name source-location) 110 (list* (definition-specifier type) 112 (sb-introspect::definition-source-description source-location))) 114 (defun find-definitions (name) 115 "Iterate over all type definitions returning two lists, DSPECs and DEFINITION-SOURCEs." 116 (let ((dspecs) (defs)) 117 (loop for type in *definition-types* by #'cddr 118 for defsrcs = (sb-introspect:find-definition-sources-by-name name type) 119 do (loop for defsrc in defsrcs 120 do (push (make-dspec type name defsrc) dspecs) 121 (dolist (d (sb-introspect:find-definition-sources-by-name name type)) (push d defs)))) 122 (values defs dspecs)))