From a598ecfb5490d424d519be3dec912fbdfd50532d Mon Sep 17 00:00:00 2001 From: Olof-Joachim Frahm Date: Wed, 21 Aug 2013 20:04:55 +0200 Subject: [PATCH 1/1] Add EXTERNAL-ONLY (as seen in SBCL). --- src/package.lisp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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)))))) -- 1.7.10.4