X-Git-Url: https://git.distorted.org.uk/~mdw/sod/blobdiff_plain/e36ab294e68c45e6f1db9896bb7de9979d69a38c..d610d8beaab27c822bd69bb857c3630b6a743b97:/doc/list-exports.lisp?ds=sidebyside diff --git a/doc/list-exports.lisp b/doc/list-exports.lisp old mode 100644 new mode 100755 index a61fe9e..240ecc2 --- a/doc/list-exports.lisp +++ b/doc/list-exports.lisp @@ -1,3 +1,8 @@ +#! /bin/sh +":"; ### -*-lisp-*- +":"; CL_SOURCE_REGISTRY=$(pwd)/build/src/:; export CL_SOURCE_REGISTRY +":"; exec cl-launch -X -l "sbcl cmucl" -s asdf -i "(sod-exports::main)" -- "$0" "$@" || exit 1 + (cl:defpackage #:sod-exports (:use #:common-lisp #+cmu #:mop @@ -32,8 +37,12 @@ (and export (list* (symbolicate code '-inst) (symbolicate 'make- code '-inst) - (mapcar (lambda (arg) - (symbolicate 'inst- arg)) + (mapcan (lambda (arg) + (let ((sym (if (listp arg) (car arg) arg))) + (cond ((char= (char (symbol-name sym) 0) #\&) + nil) + (t + (list (symbolicate 'inst- sym)))))) args))))) (defmethod form-list-exports ((head (eql 'sod::define-tagged-type)) tail) @@ -43,6 +52,20 @@ (symbolicate 'c- kind '-type) (symbolicate 'make- kind '-type)))) +(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))) @@ -368,9 +391,11 @@ (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) @@ -418,17 +443,16 @@ (export 'report-project-symbols) (defun report-project-symbols () (labels ((components (comp) - (slot-value comp 'asdf::components)) + (asdf:component-children comp)) (files (comp) (sort (remove-if-not (lambda (comp) (typep comp 'asdf:cl-source-file)) (components comp)) #'string< :key #'asdf:component-name)) (by-name (comp name) - (find name (components comp) - :test #'string= :key #'asdf:component-name)) + (gethash name (asdf:component-children-by-name comp))) (file-name (file) - (slot-value file 'asdf::absolute-pathname))) + (slot-value file 'asdf/component:absolute-pathname))) (let* ((sod (asdf:find-system "sod")) (parser-files (files (by-name sod "parser"))) (utilities (by-name sod "utilities")) @@ -442,7 +466,11 @@ (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)) +(defun main () + (with-open-file (*standard-output* #p"doc/SYMBOLS" + :direction :output + :if-exists :supersede + :if-does-not-exist :create) + (report-project-symbols))) + +#+interactive (main)