From: Olof-Joachim Frahm Date: Wed, 21 Aug 2013 18:04:55 +0000 (+0200) Subject: Add EXTERNAL-ONLY (as seen in SBCL). X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=a598ecfb5490d424d519be3dec912fbdfd50532d;hp=2d702ed4cf4809996de0196f28ab7a904f80bd9b;p=jscl.git Add EXTERNAL-ONLY (as seen in SBCL). --- diff --git a/src/package.lisp b/src/package.lisp index 317ab41..b93fe02 100644 --- a/src/package.lisp +++ b/src/package.lisp @@ -155,6 +155,10 @@ (dolist (package *package-list*) (map-for-in function (%package-symbols package)))) +(defun %map-all-external-symbols (function) + (dolist (package *package-list*) + (map-for-in function (%package-external-symbols package)))) + (defmacro do-symbols ((var &optional (package '*package*) result-form) &body body) `(block nil @@ -175,9 +179,12 @@ (defmacro do-all-symbols ((var &optional result-form) &body body) `(block nil (%map-all-symbols (lambda (,var) ,@body)) ,result-form)) -(defun find-all-symbols (string) +(defmacro do-all-external-symbols ((var &optional result-form) &body body) + `(block nil (%map-all-external-symbols (lambda (,var) ,@body)) ,result-form)) + +(defun find-all-symbols (string &optional external-only) (let (symbols) (dolist (package *package-list* symbols) (multiple-value-bind (symbol status) (find-symbol string package) - (when status + (when (if external-only (eq status :external) status) (pushnew symbol symbols :test #'eq))))))