X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=cl-symbols.lisp;h=ab709f6a76ac7b9734186a850567c47ef93ac205;hb=2e3ad5d3e39c3eb6da33c0e9a0002f1bfbd2d09a;hp=80d9b41792228e56a4311014635acecbb600f626;hpb=0e5343fda28c559f11e003805727f4c625d178f3;p=kmrcl.git diff --git a/cl-symbols.lisp b/cl-symbols.lisp index 80d9b41..ab709f6 100644 --- a/cl-symbols.lisp +++ b/cl-symbols.lisp @@ -7,12 +7,13 @@ ;;;; Programmer: Kevin M. Rosenberg ;;;; Date Started: Apr 2000 ;;;; -;;;; $Id: cl-symbols.lisp,v 1.2 2002/10/06 13:30:17 kevin Exp $ +;;;; $Id: cl-symbols.lisp,v 1.5 2002/12/15 17:10:50 kevin Exp $ ;;;; -;;;; This file, part of Kmrcl, is Copyright (c) 2002 by Kevin M. Rosenberg +;;;; This file, part of KMRCL, is Copyright (c) 2002 by Kevin M. Rosenberg ;;;; -;;;; Kmrcl 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 :kmrcl) @@ -41,3 +42,31 @@ (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 (intern #-case-sensitive (string-upcase name) + #+case-sensitive name + :keyword)) + (symbol (intern (symbol-name name) :keyword))))