X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=cl-symbols.lisp;h=97a9a92ef3405bf5c031020c6194ce97534d3a5c;hb=c0fe2c8fed48e08ef1ebb324f50d13db0d6d5042;hp=3da0a0aab36f9eaa89b4610d048037fe7c6a0402;hpb=5e5cc3c20a925d8af5de153a118fdaf0792dd7e2;p=kmrcl.git diff --git a/cl-symbols.lisp b/cl-symbols.lisp index 3da0a0a..97a9a92 100644 --- a/cl-symbols.lisp +++ b/cl-symbols.lisp @@ -7,15 +7,16 @@ ;;;; Programmer: Kevin M. Rosenberg ;;;; Date Started: Apr 2000 ;;;; -;;;; $Id: cl-symbols.lisp,v 1.1 2002/10/06 13:21:47 kevin Exp $ +;;;; $Id: cl-symbols.lisp,v 1.4 2002/12/13 21:59:57 kevin Exp $ ;;;; -;;;; This file, part of Genutils, is Copyright (c) 2002 by Kevin M. Rosenberg +;;;; This file, part of KMRCL, is Copyright (c) 2002 by Kevin M. Rosenberg ;;;; -;;;; Genutils users are granted the rights to distribute and use this software -;;;; as governed by the terms of the GNU General Public License. +;;;; KMRCL users are granted the rights to distribute and use this software +;;;; as governed by the terms of the Lisp Lesser GNU Public License +;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL. ;;;; ************************************************************************* -(in-package :genutils) +(in-package :kmrcl) (defun cl-symbols () (append (cl-variables) (cl-functions))) @@ -41,3 +42,32 @@ (fboundp sym)) (push sym funcs)))) (nreverse funcs))) + +;;; Symbol functions + +(defun concat-symbol-pkg (pkg &rest args) + (declare (dynamic-extent args)) + (flet ((stringify (arg) + (etypecase arg + (string + (string-upcase arg)) + (symbol + (symbol-name arg))))) + (let ((str (apply #'concatenate 'string (mapcar #'stringify args)))) + (intern #-case-sensitive (string-upcase str) + #+case-sensitive str + (if pkg pkg *package*))))) + + +(defun concat-symbol (&rest args) + (apply #'concat-symbol-pkg nil args)) + +(defun ensure-keyword (name) + "Returns keyword for a name" + (etypecase name + (keyword name) + (string (values (intern + #-case-sensitive (string-upcase name) + #+case-sensitive name + :keyword))) + (symbol (values (intern (symbol-name name)) :keyword))))