getting rid of the _uffi.dll
authorVictor <victor@victor-mobi>
Sun, 20 Oct 2013 13:37:41 +0000 (16:37 +0300)
committerVictor <anyakinvictor@yahoo.com>
Sun, 20 Oct 2013 13:37:41 +0000 (16:37 +0300)
clsql-uffi.asd
sql/expressions.lisp
uffi/clsql-uffi-loader.lisp
uffi/clsql-uffi.lisp

index 5629d45b5c3a80d12cdae7afd5295da0507d6927..84bfeb2f89c45c68ece2969a5817f7cb5bad223c 100644 (file)
 (defpackage clsql-uffi-system (:use #:asdf #:cl))
 (in-package clsql-uffi-system)
 
-(defvar *clsql-uffi-library-dir*
-  (merge-pathnames "uffi/"
-                  (make-pathname :name nil :type nil :defaults *load-truename*)))
+;; (defvar *clsql-uffi-library-dir*
+;;   (merge-pathnames "uffi/"
+;;                (make-pathname :name nil :type nil :defaults *load-truename*)))
 
-(defclass clsql-uffi-source-file (c-source-file)
-  ())
+;; (defclass clsql-uffi-source-file (c-source-file)
+;;   ())
 
 
-(defmethod output-files ((o compile-op) (c clsql-uffi-source-file))
-  (let* ((library-file-type
-         (funcall (intern (symbol-name'#:default-foreign-library-type)
-                          (symbol-name '#:uffi))))
-        (found
-         (some #'(lambda (dir)
-                   (probe-file (make-pathname
-                                :directory dir
-                                :name (component-name c)
-                                :type library-file-type)))
-               '((:absolute "usr" "lib" "clsql")))))
-    (list (if found
-             found
-             (make-pathname :name (component-name c)
-                            :type library-file-type
-                            :defaults *clsql-uffi-library-dir*)))))
+;; (defmethod output-files ((o compile-op) (c clsql-uffi-source-file))
+;;   (let* ((library-file-type
+;;       (funcall (intern (symbol-name'#:default-foreign-library-type)
+;;                        (symbol-name '#:uffi))))
+;;      (found
+;;       (some #'(lambda (dir)
+;;                 (probe-file (make-pathname
+;;                              :directory dir
+;;                              :name (component-name c)
+;;                              :type library-file-type)))
+;;             '((:absolute "usr" "lib" "clsql")))))
+;;     (list (if found
+;;           found
+;;           (make-pathname :name (component-name c)
+;;                          :type library-file-type
+;;                          :defaults *clsql-uffi-library-dir*)))))
 
-(defmethod perform ((o load-op) (c clsql-uffi-source-file))
-  nil) ;;; library will be loaded by a loader file
+;; (defmethod perform ((o load-op) (c clsql-uffi-source-file))
+;;   nil) ;;; library will be loaded by a loader file
 
-(defmethod operation-done-p ((o load-op) (c clsql-uffi-source-file))
-  (and (find-package '#:clsql-uffi)
-       (symbol-function (intern (symbol-name '#:atol64)
-                               (find-package '#:clsql-uffi)))
-       t))
+;; (defmethod operation-done-p ((o load-op) (c clsql-uffi-source-file))
+;;   (and (find-package '#:clsql-uffi)
+;;        (symbol-function (intern (symbol-name '#:atol64)
+;;                             (find-package '#:clsql-uffi)))
+;;        t))
 
-(defmethod perform ((o compile-op) (c clsql-uffi-source-file))
-  (unless (operation-done-p o c)
-    #-(or win32 win64 windows mswindows)
-    (unless (zerop (run-shell-command
-                   #-(or freebsd netbsd) "cd ~A; make"
-                   #+(or freebsd netbsd) "cd ~A; gmake"
-                   (namestring *clsql-uffi-library-dir*)))
-      (error 'operation-error :component c :operation o))))
+;; (defmethod perform ((o compile-op) (c clsql-uffi-source-file))
+;;   (unless (operation-done-p o c)
+;;     #-(or win32 win64 windows mswindows)
+;;     (unless (zerop (run-shell-command
+;;                 #-(or freebsd netbsd) "cd ~A; make"
+;;                 #+(or freebsd netbsd) "cd ~A; gmake"
+;;                 (namestring *clsql-uffi-library-dir*)))
+;;       (error 'operation-error :component c :operation o))))
 
-(defmethod operation-done-p ((o compile-op) (c clsql-uffi-source-file))
-  (or (and (probe-file #p"/usr/lib/clsql/clsql_uffi.so") t)
-      (let ((lib (make-pathname :defaults (component-pathname c)
-                               :type (funcall (intern (symbol-name '#:default-foreign-library-type)
-                                                       (find-package '#:uffi))))))
-       (and (probe-file lib) (probe-file (component-pathname c))
-            (> (file-write-date lib) (file-write-date (component-pathname c)))))))
+;; (defmethod operation-done-p ((o compile-op) (c clsql-uffi-source-file))
+;;   (or (and (probe-file #p"/usr/lib/clsql/clsql_uffi.so") t)
+;;       (let ((lib (make-pathname :defaults (component-pathname c)
+;;                             :type (funcall (intern (symbol-name '#:default-foreign-library-type)
+;;                                                        (find-package '#:uffi))))))
+;;     (and (probe-file lib) (probe-file (component-pathname c))
+;;          (> (file-write-date lib) (file-write-date (component-pathname c)))))))
 
 (defsystem clsql-uffi
   :name "cl-sql-base"
@@ -85,6 +85,7 @@
   ((:module :uffi
            :components
            ((:file "clsql-uffi-package")
-            (:clsql-uffi-source-file "clsql_uffi" :depends-on ("clsql-uffi-package"))
-            (:file "clsql-uffi-loader" :depends-on ("clsql-uffi-package" "clsql_uffi"))
-            (:file "clsql-uffi" :depends-on ("clsql-uffi-loader"))))))
+;;          (:clsql-uffi-source-file "clsql_uffi" :depends-on ("clsql-uffi-package"))
+;;          (:file "clsql-uffi-loader" :depends-on ("clsql-uffi-package" "clsql_uffi"))
+             (:file "clsql-uffi-loader" :depends-on ("clsql-uffi-package"))
+            (:file "clsql-uffi" :depends-on ("clsql-uffi-package"))))))
index 16bf687567ebc75e7dec65ed895ed5de92fda40b..35b163f5c3a91b65088116d0b6ac2dec502cb4c3 100644 (file)
@@ -1105,6 +1105,7 @@ uninclusive, and the args from that keyword to the end."
    (cons (symbol-name-default-case "UNSIGNED") "UNSIGNED")
    (cons (symbol-name-default-case "ZEROFILL") "ZEROFILL")
    (cons (symbol-name-default-case "AUTO-INCREMENT") "AUTO_INCREMENT")
+   (cons (symbol-name-default-case "AUTOINCREMENT") "AUTOINCREMENT")
    (cons (symbol-name-default-case "DEFAULT") "DEFAULT")
    (cons (symbol-name-default-case "UNIQUE") "UNIQUE")
    (cons (symbol-name-default-case "IDENTITY") "IDENTITY (1,1)") ;; added for sql-server support
index 7d1ebec151f5da36569101544957b07dd7300e47..d549ccb95ca69b44a2b27fc1dcdc78714961ede0 100644 (file)
@@ -54,12 +54,12 @@ set to the right path before compiling or loading the system.")
 (defvar *uffi-library-loaded* nil
   "T if foreign library was able to be loaded successfully")
 
-(defun load-uffi-foreign-library ()
-  (clsql:push-library-path clsql-uffi-system::*clsql-uffi-library-dir*)
-  (find-and-load-foreign-library *clsql-uffi-library-filenames*
-                                 :module "clsql-uffi"
-                                 :supporting-libraries
-                                 *clsql-uffi-supporting-libraries*)
-  (setq *uffi-library-loaded* t))
+;; (defun load-uffi-foreign-library ()
+;;   (clsql:push-library-path clsql-uffi-system::*clsql-uffi-library-dir*)
+;;   (find-and-load-foreign-library *clsql-uffi-library-filenames*
+;;                                  :module "clsql-uffi"
+;;                                  :supporting-libraries
+;;                                  *clsql-uffi-supporting-libraries*)
+;;   (setq *uffi-library-loaded* t))
 
-(load-uffi-foreign-library)
+;; (load-uffi-foreign-library)
index 79d423f0d37b0c91043036fd6a071f34727af0b6..76dfd043c7aac23907eb9f530c745c94518cb4a7 100644 (file)
      (radix :int))
   :returning :unsigned-long)
 
+#-windows
+(uffi:def-function ("strtoull" c-strtoull)
+    ((str (* :unsigned-char))
+     (endptr (* :unsigned-char))
+     (radix :int))
+  :returning :unsigned-long-long)
+
+#+windows
+(uffi:def-function ("_strtoui64" c-strtoull)
+    ((str (* :unsigned-char))
+     (endptr (* :unsigned-char))
+     (radix :int))
+  :returning :unsigned-long-long)
+
 (uffi:def-function "atol"
     ((str (* :unsigned-char)))
   :returning :long)
            (type char-ptr-def char-ptr))
   (c-strtoul char-ptr uffi:+null-cstring-pointer+ 10))
 
+(defun strtoull (char-ptr)
+  (declare (optimize (speed 3) (safety 0) (space 0))
+           (type char-ptr-def char-ptr))
+  (c-strtoull char-ptr uffi:+null-cstring-pointer+ 10))
+
 (defun convert-raw-field (char-ptr type &key length encoding)
  (declare (optimize (speed 3) (safety 0) (space 0))
           (type char-ptr-def char-ptr))
       (:uint
        (strtoul char-ptr))
       ((:int64 :uint64)
-       (uffi:with-foreign-object (high32-ptr :unsigned-int)
+       (strtoull char-ptr)
+       #|(uffi:with-foreign-object (high32-ptr :unsigned-int)
          (let ((low32 (atol64 char-ptr high32-ptr))
                (high32 (uffi:deref-pointer high32-ptr :unsigned-int)))
            (if (zerop high32)
                low32
-               (make-64-bit-integer high32 low32)))))
+               (make-64-bit-integer high32 low32))))|#
+)
       (:blob
        (if length
            (uffi:convert-from-foreign-usb8 char-ptr length)