3da0a0aab36f9eaa89b4610d048037fe7c6a0402
[kmrcl.git] / cl-symbols.lisp
1 ;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10 -*-
2 ;;;; *************************************************************************
3 ;;;; FILE IDENTIFICATION
4 ;;;;
5 ;;;; Name:          cl-symbols.lisp
6 ;;;; Purpose:       Returns all defined Common Lisp symbols
7 ;;;; Programmer:    Kevin M. Rosenberg
8 ;;;; Date Started:  Apr 2000
9 ;;;;
10 ;;;; $Id: cl-symbols.lisp,v 1.1 2002/10/06 13:21:47 kevin Exp $
11 ;;;;
12 ;;;; This file, part of Genutils, is Copyright (c) 2002 by Kevin M. Rosenberg
13 ;;;;
14 ;;;; Genutils users are granted the rights to distribute and use this software
15 ;;;; as governed by the terms of the GNU General Public License.
16 ;;;; *************************************************************************
17
18 (in-package :genutils)
19
20 (defun cl-symbols ()
21   (append (cl-variables) (cl-functions)))
22
23 (defun cl-variables ()
24   (let ((vars '()))
25     (do-symbols (s 'common-lisp)
26       (multiple-value-bind (sym status)
27           (find-symbol (symbol-name s) 'common-lisp)
28         (when (and (or (eq status :external)
29                        (eq status :internal))
30                    (boundp sym))
31           (push sym vars))))
32     (nreverse vars)))
33
34 (defun cl-functions ()
35   (let ((funcs '()))
36     (do-symbols (s 'common-lisp)
37       (multiple-value-bind (sym status)
38         (find-symbol (symbol-name s) 'common-lisp)
39         (when (and (or (eq status :external)
40                        (eq status :internal))
41                    (fboundp sym))
42           (push sym funcs))))
43     (nreverse funcs)))