X-Git-Url: https://git.distorted.org.uk/~mdw/sod/blobdiff_plain/b9d603a074ce320686143ef4e18b990e3791b4bf..e43d353268fc869045f757932d78d6073db9de6e:/doc/list-exports.lisp diff --git a/doc/list-exports.lisp b/doc/list-exports.lisp index 5cb8600..598d1c7 100644 --- a/doc/list-exports.lisp +++ b/doc/list-exports.lisp @@ -1,3 +1,8 @@ +(cl:defpackage #:sod-exports + (:use #:common-lisp)) + +(cl:in-package #:sod-exports) + (defun symbolicate (&rest things) (intern (apply #'concatenate 'string (mapcar #'string things)))) @@ -9,7 +14,7 @@ (declare (ignore head tail)) nil)) -(defmethod form-list-exports ((head (eql 'export)) tail) +(defmethod form-list-exports ((head (eql 'cl:export)) tail) (let ((symbols (car tail))) (if (and (consp symbols) (eq (car symbols) 'quote)) @@ -17,7 +22,7 @@ (if (atom thing) (list thing) thing)) (incomprehensible-form head tail)))) -(defmethod form-list-exports ((head (eql 'definst)) tail) +(defmethod form-list-exports ((head (eql 'sod:definst)) tail) (destructuring-bind (code (streamvar &key export) args &body body) tail (declare (ignore streamvar body)) (and export @@ -27,20 +32,34 @@ (symbolicate 'inst- arg)) args))))) -(defmethod form-list-exports ((head (eql 'define-tagged-type)) tail) +(defmethod form-list-exports ((head (eql 'sod::define-tagged-type)) tail) (destructuring-bind (kind what) tail (declare (ignore what)) (list kind (symbolicate 'c- kind '-type) (symbolicate 'make- kind '-type)))) -(defmethod form-list-exports ((head (eql 'macrolet)) tail) +(defmethod form-list-exports ((head (eql 'sod:defctype)) tail) + (destructuring-bind (names value &key export) tail + (declare (ignore value)) + (let ((names (if (listp names) names (list names)))) + (and export + (list* (symbolicate 'c-type- (car names)) names))))) + +(defmethod form-list-exports ((head (eql 'sod:define-simple-c-type)) tail) + (destructuring-bind (names type &key export) tail + (declare (ignore type)) + (let ((names (if (listp names) names (list names)))) + (and export + (list* (symbolicate 'c-type- (car names)) names))))) + +(defmethod form-list-exports ((head (eql 'cl:macrolet)) tail) (mapcan #'form-exports (cdr tail))) -(defmethod form-list-exports ((head (eql 'eval-when)) tail) +(defmethod form-list-exports ((head (eql 'cl:eval-when)) tail) (mapcan #'form-exports (cdr tail))) -(defmethod form-list-exports ((head (eql 'progn)) tail) +(defmethod form-list-exports ((head (eql 'cl:progn)) tail) (mapcan #'form-exports tail)) (defgeneric form-exports (form) @@ -69,7 +88,8 @@ (defun find-symbol-homes (paths package) (let* ((symbols (list-exported-symbols package)) - (exports-alist (mapcan #'list-exports paths)) + (exports-alist (let ((*package* package)) + (mapcan #'list-exports paths))) (homes (make-hash-table :test #'equal))) (dolist (assoc exports-alist) (let ((home (car assoc))) @@ -356,9 +376,11 @@ (sb-mop:class-direct-slots class))) (exported (remove-if (lambda (sym) - (and (not (exported-symbol-p sym)) - (eq (symbol-package sym) - package))) + (or (not (symbol-package sym)) + (and (not (exported-symbol-p + sym)) + (eq (symbol-package sym) + package)))) slot-names))) (and exported (list (cons (class-name class) @@ -403,6 +425,7 @@ (analyse-generic-functions package) (terpri)) +(export 'report-project-symbols) (defun report-project-symbols () (labels ((components (comp) (slot-value comp 'asdf::components)) @@ -428,3 +451,8 @@ (report-symbols (mapcar #'file-name parser-files) "SOD-PARSER") (report-symbols (mapcar #'file-name (list optparse)) "OPTPARSE") (report-symbols (mapcar #'file-name (list utilities)) "SOD-UTILITIES")))) + +#+interactive +(with-open-file (*standard-output* #p"doc/SYMBOLS" :direction :output + :if-exists :supersede :if-does-not-exist :create) + (report-project-symbols))