X-Git-Url: https://git.distorted.org.uk/~mdw/sod/blobdiff_plain/6213be581b6fd4836c19af2f7970ecead5f8ae97..6afec9101d5ea87e3df4bda2239ffd05f8154fa6:/doc/list-exports diff --git a/doc/list-exports b/doc/list-exports index c82100a..1d9b0c4 100755 --- a/doc/list-exports +++ b/doc/list-exports @@ -1,6 +1,8 @@ #! /bin/sh ":"; ### -*-lisp-*- -":"; CL_SOURCE_REGISTRY=$(pwd)/build/src/:; export CL_SOURCE_REGISTRY +":"; CL_SOURCE_REGISTRY=$(pwd)/build/src/: +":"; ASDF_OUTPUT_TRANSLATIONS=$(pwd)/src:$(pwd)/build/src +":"; export CL_SOURCE_REGISTRY ASDF_OUTPUT_TRANSLATIONS ":"; exec cl-launch -X -l "sbcl cmucl" -s asdf -i "(sod-exports::main)" -- "$0" "$@" || exit 1 (cl:defpackage #:sod-exports @@ -157,6 +159,42 @@ (and export (list* (symbolicate 'c-type- (car names)) names))))) +(defmethod form-list-exports + ((head (eql 'sod::define-cross-product-types)) tail) + "Return the symbols exported by a `define-cross-product-types' form. + + This is a scummy internal macro in `c-types-impl.lisp'. The syntax is + + (define-cross-product-types PIECES) + + Each piece can be a list of strings, or an atomic string (which is + equivalent to a list containing just that string). For each string formed + by concatenating one element from each list in order, define a C type with + that name; the Lisp name is constructed by translating the letters to + uppercase and replacing underscores by hyphens. For each such name, + export `NAME' and `c-type-NAME'." + + ;; Huh. I feel a hack coming on. + (mapcar (lambda (row) + (intern (with-output-to-string (out) + (dolist (s row) + (dotimes (i (length s)) + (let ((ch (char s i))) + (if (char= ch #\_) + (write-char #\- out) + (write-char (char-upcase ch) out)))))))) + (reduce (lambda (piece tails) + (mapcan (lambda (tail) + (mapcar (lambda (head) + (cons head tail)) + (if (listp piece) piece + (list piece)))) + tails)) + (cons '("" "c-type_") tail) + :from-end t + :initial-value '(nil)))) + + (defmethod form-list-exports ((head (eql 'cl:macrolet)) tail) "Return the symbols expored by a toplevel `macrolet' form. @@ -320,9 +358,9 @@ categorizing the kinds of definitions that SYMBOL has." (let ((things nil)) - (when (boundp symbol) + (when (or (boundp symbol) (documentation symbol 'variable)) (push (if (constantp symbol) :constant :variable) things)) - (when (fboundp symbol) + (when (or (fboundp symbol) (documentation symbol 'function)) (push (cond ((macro-function symbol) :macro) ((typep (fdefinition symbol) 'generic-function) :generic) @@ -332,8 +370,8 @@ (generic-function (push :setf-generic things)) (function (push :setf-function things)) (null))) - (when (find-class symbol nil) - (push :class things)) + (when (or (find-class symbol nil) (documentation symbol 'type)) + (push (if (find-class symbol nil) :class :type) things)) (when (specialized-on-p #'sod:expand-c-type-spec 0 symbol) (push :c-type-spec things)) (when (specialized-on-p #'sod:expand-c-type-form 0 symbol)