r9326: improve case conversion
[uffi.git] / src / primitives.lisp
index 26737bdce30205db01bcb2bee0eab4a6fa27ff67..17eb941160266abcab9d1276c2054b7ba051e9a8 100644 (file)
@@ -295,9 +295,20 @@ supports takes advantage of this optimization."
      ((and (eq (car result) :pointer) (eq context :allocation) :pointer))
      (t result))))
 
+(eval-when (:compile-toplevel :load-toplevel :execute)
+  (when (char= #\a (schar (symbol-name '#:a) 0))
+    (pushnew :uffi-lowercase-reader *features*))
+  (when (not (string-equal (symbol-name '#:a)
+                          (symbol-name '#:A)))
+    (pushnew :uffi-case-sensitive *features*)))
 
 (defun make-lisp-name (name)
   (let ((converted (substitute #\- #\_ name)))
      (intern 
-      #+case-sensitive converted
-      #-case-sensitive (string-upcase converted))))
+      #+uffi-case-sensitive converted
+      #+(and (not uffi-lowercase-reader) (not uffi-case-sensitive)) (string-upcase converted)
+      #+(and uffi-lowercase-reader (not uffi-case-sensitive)) (string-downcase converted))))
+
+(eval-when (:compile-toplevel :load-toplevel :execute)
+  (setq cl:*features* (delete :uffi-lowercase-reader *features*))
+  (setq cl:*features* (delete :uffi-case-sensitive *features*)))