r8945: fix typos
[clsql.git] / base / utils.lisp
index 57e3e26fb5f0559de0c2a43e3e447adbd0c5b216..c9590ec2fd96ec31e0c66a69d38a6e2ce2ae9230 100644 (file)
@@ -178,14 +178,14 @@ returns (VALUES string-output error-output exit-status)"
     
     #+lispworks
     ;; BUG: Lispworks combines output and error streams
-    (let ((output (make-output-string-stream)))
+    (let ((output (make-string-output-stream)))
       (unwind-protect
          (let ((status 
                 (system:call-system-showing-output
                  command
                  :shell-type "/bin/sh"
                  :output-stream output)))
-           (values (get-output-string output) nil status))
+           (values (get-output-stream-string output) nil status))
        (close output)))
     
     #+clisp            
@@ -213,3 +213,28 @@ returns (VALUES string-output error-output exit-status)"
     (error "COMMAND-OUTPUT not implemented for this Lisp")
 
     ))
+
+(eval-when (:compile-toplevel :load-toplevel :execute)
+  (when (char= #\a (schar (symbol-name '#:a) 0))
+    (pushnew :lowercase-reader *features*)))
+
+(defun string-default-case (str)
+  #-lowercase-reader
+  (string-upcase str)
+  #+lowercase-reader
+  (string-downcase str))
+
+;; From KMRCL
+(defun ensure-keyword (name)
+  "Returns keyword for a name"
+  (etypecase name
+    (keyword name)
+    (string (nth-value 0 (intern (string-default-case name) :keyword)))
+    (symbol (nth-value 0 (intern (symbol-name name) :keyword)))))
+
+;; From KMRCL
+(defmacro in (obj &rest choices)
+  (let ((insym (gensym)))
+    `(let ((,insym ,obj))
+       (or ,@(mapcar #'(lambda (c) `(eql ,insym ,c))
+                     choices)))))