From: Victor Date: Sun, 20 Oct 2013 13:37:41 +0000 (+0300) Subject: getting rid of the _uffi.dll X-Git-Tag: v6.5.0~16^2 X-Git-Url: http://git.kpe.io/?p=clsql.git;a=commitdiff_plain;h=eabede9da3e61ef5191b601dcf9b30f30f613f3e getting rid of the _uffi.dll --- diff --git a/clsql-uffi.asd b/clsql-uffi.asd index 5629d45..84bfeb2 100644 --- a/clsql-uffi.asd +++ b/clsql-uffi.asd @@ -19,56 +19,56 @@ (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")))))) diff --git a/sql/expressions.lisp b/sql/expressions.lisp index 16bf687..35b163f 100644 --- a/sql/expressions.lisp +++ b/sql/expressions.lisp @@ -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 diff --git a/uffi/clsql-uffi-loader.lisp b/uffi/clsql-uffi-loader.lisp index 7d1ebec..d549ccb 100644 --- a/uffi/clsql-uffi-loader.lisp +++ b/uffi/clsql-uffi-loader.lisp @@ -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) diff --git a/uffi/clsql-uffi.lisp b/uffi/clsql-uffi.lisp index 79d423f..76dfd04 100644 --- a/uffi/clsql-uffi.lisp +++ b/uffi/clsql-uffi.lisp @@ -71,6 +71,20 @@ (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) @@ -108,6 +122,11 @@ (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)) @@ -127,12 +146,14 @@ (: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)