1 ;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10 -*-
2 ;;;; *************************************************************************
3 ;;;; FILE IDENTIFICATION
5 ;;;; Name: cl-symbols.lisp
6 ;;;; Purpose: Returns all defined Common Lisp symbols
7 ;;;; Programmer: Kevin M. Rosenberg
8 ;;;; Date Started: Apr 2000
10 ;;;; $Id: symbols.lisp,v 1.1 2003/04/28 23:51:59 kevin Exp $
12 ;;;; This file, part of KMRCL, is Copyright (c) 2002 by Kevin M. Rosenberg
14 ;;;; KMRCL users are granted the rights to distribute and use this software
15 ;;;; as governed by the terms of the Lisp Lesser GNU Public License
16 ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL.
17 ;;;; *************************************************************************
22 (append (cl-variables) (cl-functions)))
24 (defun cl-variables ()
26 (do-symbols (s 'common-lisp)
27 (multiple-value-bind (sym status)
28 (find-symbol (symbol-name s) 'common-lisp)
29 (when (and (or (eq status :external)
30 (eq status :internal))
35 (defun cl-functions ()
37 (do-symbols (s 'common-lisp)
38 (multiple-value-bind (sym status)
39 (find-symbol (symbol-name s) 'common-lisp)
40 (when (and (or (eq status :external)
41 (eq status :internal))
48 (defun concat-symbol-pkg (pkg &rest args)
49 (declare (dynamic-extent args))
50 (flet ((stringify (arg)
56 (let ((str (apply #'concatenate 'string (mapcar #'stringify args))))
57 (intern #-case-sensitive (string-upcase str)
59 (if pkg pkg *package*)))))
62 (defun concat-symbol (&rest args)
63 (apply #'concat-symbol-pkg nil args))
65 (defun ensure-keyword (name)
66 "Returns keyword for a name"
69 (string (intern #-case-sensitive (string-upcase name)
72 (symbol (intern (symbol-name name) :keyword))))
74 (defun show (&optional (what :variables) (package *package*))
76 (:variables (show-variables package))
77 (:functions (show-functions package))))
79 (defun show-variables (package)
80 (do-symbols (s package)
81 (multiple-value-bind (sym status)
82 (find-symbol (symbol-name s) package)
83 (when (and (or (eq status :external)
84 (eq status :internal))
86 (format t "~&Symbol ~S~T -> ~S~%"
88 (symbol-value sym))))))
90 (defun show-functions (package)
91 (do-symbols (s package)
92 (multiple-value-bind (sym status)
93 (find-symbol (symbol-name s) package)
94 (when (and (or (eq status :external)
95 (eq status :internal))
97 (format t "~&Function ~S~T -> ~S~%"
99 (symbol-function sym))))))