From: Kevin M. Rosenberg Date: Wed, 18 Sep 2002 07:51:22 +0000 (+0000) Subject: r2755: move files X-Git-Tag: v3.8.6~941 X-Git-Url: http://git.kpe.io/?p=clsql.git;a=commitdiff_plain;h=2434b58ef00a7f6c5915c86b25a891c4adda79e4;ds=sidebyside r2755: move files --- diff --git a/Makefile b/Makefile index 4b7b229..675bc26 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ # Programer: Kevin M. Rosenberg # Date Started: Mar 2002 # -# CVS Id: $Id: Makefile,v 1.23 2002/09/18 07:43:40 kevin Exp $ +# CVS Id: $Id: Makefile,v 1.24 2002/09/18 07:51:22 kevin Exp $ # # This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg # @@ -15,13 +15,13 @@ PKG := clsql DEBPKG := cl-sql -SUBDIRS := sql clsql-uffi base clsql-mysql clsql-aodbc \ - clsql-postgresql clsql-postgresql-socket +SUBDIRS := sql uffi base db-mysql db-aodbc \ + db-postgresql db-postgresql-socket DOCSUBDIRS:=doc include Makefile.common -LIBSUBDIRS=clsql-mysql clsql-uffi +LIBSUBDIRS=db-mysql uffi .PHONY: subdirs $(LIBSUBDIRS) .PHONY: all diff --git a/clsql-aodbc.asd b/clsql-aodbc.asd index 58eb3d8..1c8e964 100644 --- a/clsql-aodbc.asd +++ b/clsql-aodbc.asd @@ -7,7 +7,7 @@ ;;;; Programmer: Kevin M. Rosenberg ;;;; Date Started: Aug 2002 ;;;; -;;;; $Id: clsql-aodbc.asd,v 1.8 2002/09/17 17:18:34 kevin Exp $ +;;;; $Id: clsql-aodbc.asd,v 1.9 2002/09/18 07:50:01 kevin Exp $ ;;;; ;;;; This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg ;;;; @@ -20,13 +20,13 @@ (defsystem :clsql-aodbc :components - ((:module :clsql-aodbc + ((:module :db-aodbc :components ((:file "aodbc-package") (:file "aodbc-sql" :depends-on ("aodbc-package"))))) :depends-on (:clsql-base)) (defmethod source-file-type ((c cl-source-file) - (s (eql (find-system 'clsql-aodbc)))) + (s (eql (find-system :clsql-aodbc)))) "cl") diff --git a/clsql-base.asd b/clsql-base.asd index c45a806..48c68a2 100644 --- a/clsql-base.asd +++ b/clsql-base.asd @@ -7,7 +7,7 @@ ;;;; Programmer: Kevin M. Rosenberg ;;;; Date Started: Feb 2002 ;;;; -;;;; $Id: clsql-base.asd,v 1.10 2002/09/17 17:16:43 kevin Exp $ +;;;; $Id: clsql-base.asd,v 1.11 2002/09/18 07:50:01 kevin Exp $ ;;;; ;;;; This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg ;;;; @@ -33,6 +33,6 @@ (:file "initialize" :depends-on ("db-interface")))))) (defmethod source-file-type ((c cl-source-file) - (s (eql (find-system 'clsql-base)))) + (s (eql (find-system :clsql-base)))) "cl") diff --git a/clsql-mysql.asd b/clsql-mysql.asd index 0af451f..515e873 100644 --- a/clsql-mysql.asd +++ b/clsql-mysql.asd @@ -7,7 +7,7 @@ ;;;; Programmer: Kevin M. Rosenberg ;;;; Date Started: Aug 2002 ;;;; -;;;; $Id: clsql-mysql.asd,v 1.6 2002/09/17 17:16:43 kevin Exp $ +;;;; $Id: clsql-mysql.asd,v 1.7 2002/09/18 07:50:01 kevin Exp $ ;;;; ;;;; This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg ;;;; @@ -24,7 +24,7 @@ (defsystem :clsql-mysql :components - ((:module :mysql + ((:module :db-mysql :components ((:file "mysql-package") (:file "mysql-loader" :depends-on ("mysql-package")) @@ -34,5 +34,5 @@ :depends-on (:uffi :clsql-base :clsql-uffi)) (defmethod source-file-type ((c cl-source-file) - (s (eql (find-system 'clsql-mysql)))) + (s (eql (find-system :clsql-mysql)))) "cl") diff --git a/clsql-oracle.asd b/clsql-oracle.asd index 9227721..8cace75 100644 --- a/clsql-oracle.asd +++ b/clsql-oracle.asd @@ -1,7 +1,7 @@ ;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10 -*- ;;;; This is copyrighted software. See interfaces/oracle/* files for terms. ;;;; -;;;; $Id: clsql-oracle.asd,v 1.6 2002/09/17 17:16:43 kevin Exp $ +;;;; $Id: clsql-oracle.asd,v 1.7 2002/09/18 07:50:01 kevin Exp $ (in-package :asdf) @@ -9,7 +9,7 @@ (defsystem :clsql-oracle :components - ((:module :clsql-oracle + ((:module :db-oracle :components ((:file "oracle-package") (:file "oracle-loader" :depends-on ("oracle-package")) @@ -21,7 +21,7 @@ :depends-on (:clsql-base)) (defmethod source-file-type ((c cl-source-file) - (s (eql (find-system 'clsql-oracle)))) + (s (eql (find-system :clsql-oracle)))) "cl") diff --git a/clsql-postgresql-socket.asd b/clsql-postgresql-socket.asd index 7c80ab2..96e9d30 100644 --- a/clsql-postgresql-socket.asd +++ b/clsql-postgresql-socket.asd @@ -7,7 +7,7 @@ ;;;; Programmer: Kevin M. Rosenberg ;;;; Date Started: Aug 2002 ;;;; -;;;; $Id: clsql-postgresql-socket.asd,v 1.6 2002/09/17 17:16:43 kevin Exp $ +;;;; $Id: clsql-postgresql-socket.asd,v 1.7 2002/09/18 07:50:01 kevin Exp $ ;;;; ;;;; This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg ;;;; @@ -23,7 +23,7 @@ (defsystem clsql-postgresql-socket :components - ((:module :clsql-postgresql-socket + ((:module :db-postgresql-socket :components ((:file "postgresql-socket-package") (:file "postgresql-socket-api" @@ -33,6 +33,6 @@ :depends-on (:clsql-base :uffi)) (defmethod source-file-type ((c cl-source-file) - (s (eql (find-system 'clsql-postgresql-socket)))) + (s (eql (find-system :clsql-postgresql-socket)))) "cl") diff --git a/clsql-postgresql.asd b/clsql-postgresql.asd index bc4b2bf..410dbdf 100644 --- a/clsql-postgresql.asd +++ b/clsql-postgresql.asd @@ -7,7 +7,7 @@ ;;;; Programmer: Kevin M. Rosenberg ;;;; Date Started: Aug 2002 ;;;; -;;;; $Id: clsql-postgresql.asd,v 1.6 2002/09/17 17:16:43 kevin Exp $ +;;;; $Id: clsql-postgresql.asd,v 1.7 2002/09/18 07:50:01 kevin Exp $ ;;;; ;;;; This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg ;;;; @@ -21,7 +21,7 @@ (defsystem :clsql-postgresql :components - ((:module :clsql-postgresql + ((:module :db-postgresql :components ((:file "postgresql-package") (:file "postgresql-loader" :depends-on ("postgresql-package")) @@ -31,6 +31,6 @@ :depends-on (:uffi :clsql-base :clsql-uffi)) (defmethod source-file-type ((c cl-source-file) - (s (eql (find-system 'clsql-postgresql)))) + (s (eql (find-system :clsql-postgresql)))) "cl") diff --git a/clsql-uffi.asd b/clsql-uffi.asd index c45d31c..e6fe6b8 100644 --- a/clsql-uffi.asd +++ b/clsql-uffi.asd @@ -7,7 +7,7 @@ ;;;; Programmer: Kevin M. Rosenberg ;;;; Date Started: Aug 2002 ;;;; -;;;; $Id: clsql-uffi.asd,v 1.8 2002/09/17 17:16:43 kevin Exp $ +;;;; $Id: clsql-uffi.asd,v 1.9 2002/09/18 07:50:01 kevin Exp $ ;;;; ;;;; This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg ;;;; @@ -33,5 +33,5 @@ (defmethod source-file-type ((c cl-source-file) - (s (eql (find-system 'clsql-uffi)))) + (s (eql (find-system :clsql-uffi)))) "cl") diff --git a/clsql-uffi/.cvsignore b/clsql-uffi/.cvsignore deleted file mode 100755 index f3eb90d..0000000 --- a/clsql-uffi/.cvsignore +++ /dev/null @@ -1,4 +0,0 @@ -clsql-uffi.so -clsql-uffi.dll -clsql-uffi.lib -.bin diff --git a/clsql-uffi/Makefile b/clsql-uffi/Makefile deleted file mode 100644 index f163b14..0000000 --- a/clsql-uffi/Makefile +++ /dev/null @@ -1,52 +0,0 @@ -# -*- Mode: Makefile -*- -########################################################################### -# FILE IDENTIFICATION -# -# Name: Makefile -# Purpose: Makefile for the CLSQL UFFI helper package -# Programer: Kevin M. Rosenberg -# Date Started: Mar 2002 -# -# CVS Id: $Id: Makefile,v 1.1 2002/08/01 03:06:27 kevin Exp $ -# -# This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg -# -# CLSQL 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. -########################################################################### - - -# These variables are correct for GCC -CC=gcc -SHARED_CC_OPT=-fPIC -DPIC -SHARED_LD_OPT=-shared # For Linux (ALL) and FreeBSD (ACL) -LD=gcc - -# Use these for Sun's C compiler and Solaris (ACL) -#CC=cc -#SHARED_CC_OPT=-KPIC -#SHARED_LD_OPT=-G -#LD=ld - -# Nothing to configure beyond this point - -base=clsql-uffi -source=$(base).c -object=$(base).o -shared_lib=$(base).so - -.PHONY: all clean distclean - -all: $(shared_lib) - -$(shared_lib): $(source) Makefile - $(CC) ${SHARED_CC_OPT} -c $(source) -o $(object) - $(LD) ${SHARED_LD_OPT} $(object) -o $(shared_lib) - @rm $(object) - -clean: - @rm -f $(object) $(shared_lib) *~ - -distclean: clean - diff --git a/clsql-uffi/Makefile.msvc b/clsql-uffi/Makefile.msvc deleted file mode 100644 index 49e52d2..0000000 --- a/clsql-uffi/Makefile.msvc +++ /dev/null @@ -1,35 +0,0 @@ -# -*- Mode: Makefile -*- -########################################################################### -# FILE IDENTIFICATION -# -# Name: Makefile.msvc -# Purpose: Makefile for the CLSQL UFFI helper package (MSVC) -# Programer: Kevin M. Rosenberg -# Date Started: Mar 2002 -# -# CVS Id: $Id: Makefile.msvc,v 1.1 2002/08/01 03:06:27 kevin Exp $ -# -# This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg -# -# CLSQL 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. -########################################################################### - - -BASE=clsql-uffi - -# Nothing to configure beyond here - -SRC=$(BASE).c -OBJ=$(BASE).obj -DLL=$(BASE).dll - -$(DLL): $(SRC) - cl /MD /LD -D_MT /DWIN32=1 /D__LCC__=1 $(SRC) - del $(OBJ) $(BASE).exp - -clean: - del /q $(DLL) - - diff --git a/clsql-uffi/clsql-uffi-loader.cl b/clsql-uffi/clsql-uffi-loader.cl deleted file mode 100644 index dabe5c9..0000000 --- a/clsql-uffi/clsql-uffi-loader.cl +++ /dev/null @@ -1,50 +0,0 @@ -;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10 -*- -;;;; ************************************************************************* -;;;; FILE IDENTIFICATION -;;;; -;;;; Name: clsql-uffi-loader.sql -;;;; Purpose: library loader using CLSQL UFFI helper library -;;;; Programmers: Kevin M. Rosenberg -;;;; Date Started: Mar 2002 -;;;; -;;;; $Id: clsql-uffi-loader.cl,v 1.2 2002/08/01 21:39:22 kevin Exp $ -;;;; -;;;; This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg -;;;; -;;;; CLSQL 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. -;;;; ************************************************************************* - -(declaim (optimize (debug 3) (speed 3) (safety 1) (compilation-speed 0))) -(in-package :clsql-uffi) - -(defvar *clsql-uffi-library-filename* - (uffi:find-foreign-library - "clsql-uffi" - `(,(directory-namestring - (translate-logical-pathname - "cl-library:clsql-uffi;")) - "/usr/lib/clsql/") - :drive-letters '("C" "D" "E" "F" "G"))) - -(defvar *clsql-uffi-supporting-libraries* '("c") - "Used only by CMU. List of library flags needed to be passed to ld to -load the MySQL client library succesfully. If this differs at your site, -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 () - (if (uffi:load-foreign-library *clsql-uffi-library-filename* - :module "clsql-uffi" - :supporting-libraries - *clsql-uffi-supporting-libraries*) - (setq *uffi-library-loaded* t) - (warn "Unable to load helper library ~A" *clsql-uffi-library-filename*))) - -(load-uffi-foreign-library) - - - diff --git a/clsql-uffi/clsql-uffi-package.cl b/clsql-uffi/clsql-uffi-package.cl deleted file mode 100644 index f096bfc..0000000 --- a/clsql-uffi/clsql-uffi-package.cl +++ /dev/null @@ -1,33 +0,0 @@ -;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10 -*- -;;;; ************************************************************************* -;;;; FILE IDENTIFICATION -;;;; -;;;; Name: clsql-uffi-package.cl -;;;; Purpose: Package definitions for common UFFI interface routines -;;;; Programmers: Kevin M. Rosenberg -;;;; Date Started: Mar 2002 -;;;; -;;;; $Id: clsql-uffi-package.cl,v 1.1 2002/08/01 03:06:27 kevin Exp $ -;;;; -;;;; This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg -;;;; -;;;; CLSQL 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. -;;;; ************************************************************************* - -(declaim (optimize (debug 3) (speed 3) (safety 1) (compilation-speed 0))) -(in-package :cl-user) - -(defpackage :clsql-uffi - (:export - #:canonicalize-type-list - #:convert-raw-field - #:atoi - #:atol - #:atof - #:atol64 - #:make-64-bit-integer - #:split-64-bit-integer) - (:documentation "Common functions for interfaces using UFFI")) - diff --git a/clsql-uffi/clsql-uffi.c b/clsql-uffi/clsql-uffi.c deleted file mode 100644 index 280ec61..0000000 --- a/clsql-uffi/clsql-uffi.c +++ /dev/null @@ -1,75 +0,0 @@ -/**************************************************************************** - * FILE IDENTIFICATION - * - * Name: clsql-uffi.c - * Purpose: Helper functions for common interfaces using UFFI - * Programmer: Kevin M. Rosenberg - * Date Started: Mar 2002 - * - * $Id: clsql-uffi.c,v 1.1 2002/08/01 03:06:27 kevin Exp $ - * - * This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg - * - * CLSQL 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. - ***************************************************************************/ - -#ifdef WIN32 -#include - -BOOL WINAPI DllEntryPoint(HINSTANCE hinstdll, DWORD fdwReason, - LPVOID lpvReserved) -{ - return 1; -} - -#define DLLEXPORT __declspec(dllexport) - -#else -#define DLLEXPORT -#endif - - -const unsigned int bitmask_32bits = 0xFFFFFFFF; -#define lower_32bits(int64) ((unsigned int) int64 & bitmask_32bits) -#define upper_32bits(int64) ((unsigned int) (int64 >> 32)) - -/* Reads a 64-bit integer string, returns result as two 32-bit integers */ - -DLLEXPORT -unsigned int -atol64 (const unsigned char* str, int* pHigh32) -{ -#ifdef WIN32 - __int64 result = 0; -#else - long long result = 0; -#endif - int minus = 0; - int first_char = *str; - if (first_char == '+') - ++str; - else if (first_char == '-') { - minus = 1; - ++str; - } - - while (*str) { - int i = *str - '0'; - if (i < 0 || i > 9) /* Non-numeric character -- quit */ - break; - result = i + (10 * result); - str++; - } - if (minus) - result = -result; - - *pHigh32 = upper_32bits(result); - return lower_32bits(result); -} - - - - - diff --git a/clsql-uffi/clsql-uffi.cl b/clsql-uffi/clsql-uffi.cl deleted file mode 100644 index b89ec1a..0000000 --- a/clsql-uffi/clsql-uffi.cl +++ /dev/null @@ -1,103 +0,0 @@ -;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10 -*- -;;;; ************************************************************************* -;;;; FILE IDENTIFICATION -;;;; -;;;; Name: clsql-uffi.cl -;;;; Purpose: Common functions for interfaces using UFFI -;;;; Programmers: Kevin M. Rosenberg -;;;; Date Started: Mar 2002 -;;;; -;;;; $Id: clsql-uffi.cl,v 1.1 2002/08/01 03:06:27 kevin Exp $ -;;;; -;;;; This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg -;;;; -;;;; CLSQL 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. -;;;; ************************************************************************* - -(declaim (optimize (debug 3) (speed 3) (safety 1) (compilation-speed 0))) -(in-package :clsql-uffi) - - -(defun canonicalize-type-list (types auto-list) - "Ensure a field type list meets expectations" - (let ((length-types (length types)) - (new-types '())) - (loop for i from 0 below (length auto-list) - do - (if (>= i length-types) - (push t new-types) ;; types is shorted than num-fields - (push - (case (nth i types) - (:int - (case (nth i auto-list) - (:int32 - :int32) - (:int64 - :int64) - (t - t))) - (:double - (case (nth i auto-list) - (:double - :double) - (t - t))) - (:int32 - (if (eq :int32 (nth i auto-list)) - :int32 - t)) - (:int64 - (if (eq :int64 (nth i auto-list)) - :int64 - t)) - (t - t)) - new-types))) - (nreverse new-types))) - -(uffi:def-function "atoi" - ((str (* :unsigned-char))) - :returning :int) - -(uffi:def-function "atol" - ((str (* :unsigned-char))) - :returning :long) - -(uffi:def-function "atof" - ((str (* :unsigned-char))) - :returning :double) - -(uffi:def-function "atol64" - ((str (* :unsigned-char)) - (high32 (* :int))) - :returning :unsigned-int) - -(uffi:def-constant +2^32+ 4294967296) -(uffi:def-constant +2^32-1+ (1- +2^32+)) - -(defmacro make-64-bit-integer (high32 low32) - `(+ ,low32 (* ,high32 +2^32+))) - -(defmacro split-64-bit-integer (int64) - `(values (ash ,int64 -32) (logand ,int64 +2^32-1+))) - -(defun convert-raw-field (char-ptr types index) - (let ((type (if (listp types) - (nth index types) - types))) - (case type - (:double - (atof char-ptr)) - ((or :int32 :int) - (atoi char-ptr)) - (:int64 - (uffi:with-foreign-object (high32-ptr :int) - (let ((low32 (atol64 char-ptr high32-ptr)) - (high32 (uffi:deref-pointer high32-ptr :int))) - (if (zerop high32) - low32 - (make-64-bit-integer high32 low32))))) - (t - (uffi:convert-from-foreign-string char-ptr))))) diff --git a/clsql-uffi/clsql-uffi.dll b/clsql-uffi/clsql-uffi.dll deleted file mode 100644 index f0bf74e..0000000 Binary files a/clsql-uffi/clsql-uffi.dll and /dev/null differ diff --git a/clsql-uffi/clsql-uffi.lib b/clsql-uffi/clsql-uffi.lib deleted file mode 100644 index 0a1bd6c..0000000 Binary files a/clsql-uffi/clsql-uffi.lib and /dev/null differ diff --git a/clsql.asd b/clsql.asd index 1625200..2890db9 100644 --- a/clsql.asd +++ b/clsql.asd @@ -7,7 +7,7 @@ ;;;; Programmer: Kevin M. Rosenberg ;;;; Date Started: Feb 2002 ;;;; -;;;; $Id: clsql.asd,v 1.7 2002/09/17 17:16:43 kevin Exp $ +;;;; $Id: clsql.asd,v 1.8 2002/09/18 07:50:01 kevin Exp $ ;;;; ;;;; This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg ;;;; @@ -35,5 +35,5 @@ ) (defmethod source-file-type ((c cl-source-file) - (s (eql (find-system 'clsql)))) +e (s (eql (find-system :clsql)))) "cl") diff --git a/debian/rules b/debian/rules index 42ae714..46cdd63 100755 --- a/debian/rules +++ b/debian/rules @@ -25,13 +25,13 @@ UPSTREAM_VER := $(shell sed -n -e "s/${pkg} (\(.*\)-[0-9A-Za-z\.]).*/\1/p" < deb ## Lisp sources srcs := sql clsql.asd srcs-base := $(wildcard base/*.cl) -srcs-uffi := $(wildcard clsql-uffi/*.cl) $(wildcard clsql-uffi/*.c) -srcs-uffi-so:= $(wildcard clsql-uffi/*.so) -srcs-mysql := $(wildcard clsql-mysql/*.cl) $(wildcard clsql-mysql/*.c) -srcs-mysql-so := $(wildcard clsql-mysql/*.so) -srcs-pg := $(wildcard clsql-postgresql/*.cl) -srcs-pg-socket := $(wildcard clsql-postgresql-socket/*.cl) -srcs-aodbc := $(wildcard clsql-aodbc/*.cl) +srcs-uffi := $(wildcard uffi/*.cl) $(wildcard uffi/*.c) +srcs-uffi-so := $(wildcard uffi/*.so) +srcs-mysql := $(wildcard db-mysql/*.cl) $(wildcard db-mysql/*.c) +srcs-mysql-so := $(wildcard db-mysql/*.so) +srcs-pg := $(wildcard db-postgresql/*.cl) +srcs-pg-socket := $(wildcard db-postgresql-socket/*.cl) +srcs-aodbc := $(wildcard db-aodbc/*.cl) clc-base := usr/share/common-lisp clc-source := $(clc-base)/source @@ -45,17 +45,17 @@ lispdir-sql := $(clc-sql)/sql clc-base := $(clc-source)/clsql-base lispdir-base := $(clc-base)/base clc-uffi := $(clc-source)/clsql-uffi -lispdir-uffi := $(clc-uffi)/clsql-uffi -sodir-uffi := usr/lib/clsql +lispdir-uffi := $(clc-uffi)/uffi +sodir-uffi := usr/lib/clsql clc-mysql := $(clc-source)/clsql-mysql -lispdir-mysql := $(clc-mysql)/clsql-mysql +lispdir-mysql := $(clc-mysql)/db-mysql sodir-mysql := usr/lib/clsql clc-pg := $(clc-source)/clsql-postgresql -lispdir-pg := $(clc-pg)/clsql-postgresql -clc-socket := $(clc-source)/clsql-postgresql-socket -lispdir-pg-socket := $(clc-pg-socket)/clsql-postgresql-socket +lispdir-pg := $(clc-pg)/db-postgresql +clc-socket := $(clc-source)/clsql-postgresql-socket +lispdir-pg-socket := $(clc-pg-socket)/db-postgresql-socket clc-aodbc := $(clc-source)/clsql-aodbc -lispdir-aodbc := $(clc-aodbc)/clsql-aodbc +lispdir-aodbc := $(clc-aodbc)/db-aodbc configure: configure-stamp diff --git a/doc/html.tar.gz b/doc/html.tar.gz index 1cd7536..31b76c4 100644 Binary files a/doc/html.tar.gz and b/doc/html.tar.gz differ diff --git a/uffi/.cvsignore b/uffi/.cvsignore new file mode 100755 index 0000000..f3eb90d --- /dev/null +++ b/uffi/.cvsignore @@ -0,0 +1,4 @@ +clsql-uffi.so +clsql-uffi.dll +clsql-uffi.lib +.bin diff --git a/uffi/Makefile b/uffi/Makefile new file mode 100644 index 0000000..8093b70 --- /dev/null +++ b/uffi/Makefile @@ -0,0 +1,52 @@ +# -*- Mode: Makefile -*- +########################################################################### +# FILE IDENTIFICATION +# +# Name: Makefile +# Purpose: Makefile for the CLSQL UFFI helper package +# Programer: Kevin M. Rosenberg +# Date Started: Mar 2002 +# +# CVS Id: $Id: Makefile,v 1.1 2002/09/18 07:50:01 kevin Exp $ +# +# This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg +# +# CLSQL 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. +########################################################################### + + +# These variables are correct for GCC +CC=gcc +SHARED_CC_OPT=-fPIC -DPIC +SHARED_LD_OPT=-shared # For Linux (ALL) and FreeBSD (ACL) +LD=gcc + +# Use these for Sun's C compiler and Solaris (ACL) +#CC=cc +#SHARED_CC_OPT=-KPIC +#SHARED_LD_OPT=-G +#LD=ld + +# Nothing to configure beyond this point + +base=clsql-uffi +source=$(base).c +object=$(base).o +shared_lib=$(base).so + +.PHONY: all clean distclean + +all: $(shared_lib) + +$(shared_lib): $(source) Makefile + $(CC) ${SHARED_CC_OPT} -c $(source) -o $(object) + $(LD) ${SHARED_LD_OPT} $(object) -o $(shared_lib) + @rm $(object) + +clean: + @rm -f $(object) $(shared_lib) *~ + +distclean: clean + diff --git a/uffi/Makefile.msvc b/uffi/Makefile.msvc new file mode 100644 index 0000000..562c3dd --- /dev/null +++ b/uffi/Makefile.msvc @@ -0,0 +1,35 @@ +# -*- Mode: Makefile -*- +########################################################################### +# FILE IDENTIFICATION +# +# Name: Makefile.msvc +# Purpose: Makefile for the CLSQL UFFI helper package (MSVC) +# Programer: Kevin M. Rosenberg +# Date Started: Mar 2002 +# +# CVS Id: $Id: Makefile.msvc,v 1.1 2002/09/18 07:50:01 kevin Exp $ +# +# This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg +# +# CLSQL 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. +########################################################################### + + +BASE=clsql-uffi + +# Nothing to configure beyond here + +SRC=$(BASE).c +OBJ=$(BASE).obj +DLL=$(BASE).dll + +$(DLL): $(SRC) + cl /MD /LD -D_MT /DWIN32=1 /D__LCC__=1 $(SRC) + del $(OBJ) $(BASE).exp + +clean: + del /q $(DLL) + + diff --git a/uffi/clsql-uffi-loader.cl b/uffi/clsql-uffi-loader.cl new file mode 100644 index 0000000..e48384f --- /dev/null +++ b/uffi/clsql-uffi-loader.cl @@ -0,0 +1,50 @@ +;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10 -*- +;;;; ************************************************************************* +;;;; FILE IDENTIFICATION +;;;; +;;;; Name: clsql-uffi-loader.sql +;;;; Purpose: library loader using CLSQL UFFI helper library +;;;; Programmers: Kevin M. Rosenberg +;;;; Date Started: Mar 2002 +;;;; +;;;; $Id: clsql-uffi-loader.cl,v 1.1 2002/09/18 07:50:01 kevin Exp $ +;;;; +;;;; This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg +;;;; +;;;; CLSQL 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. +;;;; ************************************************************************* + +(declaim (optimize (debug 3) (speed 3) (safety 1) (compilation-speed 0))) +(in-package :clsql-uffi) + +(defvar *clsql-uffi-library-filename* + (uffi:find-foreign-library + "clsql-uffi" + `(,(directory-namestring + (translate-logical-pathname + "cl-library:clsql-uffi;")) + "/usr/lib/clsql/") + :drive-letters '("C" "D" "E" "F" "G"))) + +(defvar *clsql-uffi-supporting-libraries* '("c") + "Used only by CMU. List of library flags needed to be passed to ld to +load the MySQL client library succesfully. If this differs at your site, +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 () + (if (uffi:load-foreign-library *clsql-uffi-library-filename* + :module "clsql-uffi" + :supporting-libraries + *clsql-uffi-supporting-libraries*) + (setq *uffi-library-loaded* t) + (warn "Unable to load helper library ~A" *clsql-uffi-library-filename*))) + +(load-uffi-foreign-library) + + + diff --git a/uffi/clsql-uffi-package.cl b/uffi/clsql-uffi-package.cl new file mode 100644 index 0000000..4b541f9 --- /dev/null +++ b/uffi/clsql-uffi-package.cl @@ -0,0 +1,33 @@ +;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10 -*- +;;;; ************************************************************************* +;;;; FILE IDENTIFICATION +;;;; +;;;; Name: clsql-uffi-package.cl +;;;; Purpose: Package definitions for common UFFI interface routines +;;;; Programmers: Kevin M. Rosenberg +;;;; Date Started: Mar 2002 +;;;; +;;;; $Id: clsql-uffi-package.cl,v 1.1 2002/09/18 07:50:01 kevin Exp $ +;;;; +;;;; This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg +;;;; +;;;; CLSQL 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. +;;;; ************************************************************************* + +(declaim (optimize (debug 3) (speed 3) (safety 1) (compilation-speed 0))) +(in-package :cl-user) + +(defpackage :clsql-uffi + (:export + #:canonicalize-type-list + #:convert-raw-field + #:atoi + #:atol + #:atof + #:atol64 + #:make-64-bit-integer + #:split-64-bit-integer) + (:documentation "Common functions for interfaces using UFFI")) + diff --git a/uffi/clsql-uffi.c b/uffi/clsql-uffi.c new file mode 100644 index 0000000..385df49 --- /dev/null +++ b/uffi/clsql-uffi.c @@ -0,0 +1,75 @@ +/**************************************************************************** + * FILE IDENTIFICATION + * + * Name: clsql-uffi.c + * Purpose: Helper functions for common interfaces using UFFI + * Programmer: Kevin M. Rosenberg + * Date Started: Mar 2002 + * + * $Id: clsql-uffi.c,v 1.1 2002/09/18 07:50:01 kevin Exp $ + * + * This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg + * + * CLSQL 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. + ***************************************************************************/ + +#ifdef WIN32 +#include + +BOOL WINAPI DllEntryPoint(HINSTANCE hinstdll, DWORD fdwReason, + LPVOID lpvReserved) +{ + return 1; +} + +#define DLLEXPORT __declspec(dllexport) + +#else +#define DLLEXPORT +#endif + + +const unsigned int bitmask_32bits = 0xFFFFFFFF; +#define lower_32bits(int64) ((unsigned int) int64 & bitmask_32bits) +#define upper_32bits(int64) ((unsigned int) (int64 >> 32)) + +/* Reads a 64-bit integer string, returns result as two 32-bit integers */ + +DLLEXPORT +unsigned int +atol64 (const unsigned char* str, int* pHigh32) +{ +#ifdef WIN32 + __int64 result = 0; +#else + long long result = 0; +#endif + int minus = 0; + int first_char = *str; + if (first_char == '+') + ++str; + else if (first_char == '-') { + minus = 1; + ++str; + } + + while (*str) { + int i = *str - '0'; + if (i < 0 || i > 9) /* Non-numeric character -- quit */ + break; + result = i + (10 * result); + str++; + } + if (minus) + result = -result; + + *pHigh32 = upper_32bits(result); + return lower_32bits(result); +} + + + + + diff --git a/uffi/clsql-uffi.cl b/uffi/clsql-uffi.cl new file mode 100644 index 0000000..2d1cd94 --- /dev/null +++ b/uffi/clsql-uffi.cl @@ -0,0 +1,103 @@ +;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10 -*- +;;;; ************************************************************************* +;;;; FILE IDENTIFICATION +;;;; +;;;; Name: clsql-uffi.cl +;;;; Purpose: Common functions for interfaces using UFFI +;;;; Programmers: Kevin M. Rosenberg +;;;; Date Started: Mar 2002 +;;;; +;;;; $Id: clsql-uffi.cl,v 1.1 2002/09/18 07:50:01 kevin Exp $ +;;;; +;;;; This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg +;;;; +;;;; CLSQL 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. +;;;; ************************************************************************* + +(declaim (optimize (debug 3) (speed 3) (safety 1) (compilation-speed 0))) +(in-package :clsql-uffi) + + +(defun canonicalize-type-list (types auto-list) + "Ensure a field type list meets expectations" + (let ((length-types (length types)) + (new-types '())) + (loop for i from 0 below (length auto-list) + do + (if (>= i length-types) + (push t new-types) ;; types is shorted than num-fields + (push + (case (nth i types) + (:int + (case (nth i auto-list) + (:int32 + :int32) + (:int64 + :int64) + (t + t))) + (:double + (case (nth i auto-list) + (:double + :double) + (t + t))) + (:int32 + (if (eq :int32 (nth i auto-list)) + :int32 + t)) + (:int64 + (if (eq :int64 (nth i auto-list)) + :int64 + t)) + (t + t)) + new-types))) + (nreverse new-types))) + +(uffi:def-function "atoi" + ((str (* :unsigned-char))) + :returning :int) + +(uffi:def-function "atol" + ((str (* :unsigned-char))) + :returning :long) + +(uffi:def-function "atof" + ((str (* :unsigned-char))) + :returning :double) + +(uffi:def-function "atol64" + ((str (* :unsigned-char)) + (high32 (* :int))) + :returning :unsigned-int) + +(uffi:def-constant +2^32+ 4294967296) +(uffi:def-constant +2^32-1+ (1- +2^32+)) + +(defmacro make-64-bit-integer (high32 low32) + `(+ ,low32 (* ,high32 +2^32+))) + +(defmacro split-64-bit-integer (int64) + `(values (ash ,int64 -32) (logand ,int64 +2^32-1+))) + +(defun convert-raw-field (char-ptr types index) + (let ((type (if (listp types) + (nth index types) + types))) + (case type + (:double + (atof char-ptr)) + ((or :int32 :int) + (atoi char-ptr)) + (:int64 + (uffi:with-foreign-object (high32-ptr :int) + (let ((low32 (atol64 char-ptr high32-ptr)) + (high32 (uffi:deref-pointer high32-ptr :int))) + (if (zerop high32) + low32 + (make-64-bit-integer high32 low32))))) + (t + (uffi:convert-from-foreign-string char-ptr))))) diff --git a/uffi/clsql-uffi.dll b/uffi/clsql-uffi.dll new file mode 100644 index 0000000..f0bf74e Binary files /dev/null and b/uffi/clsql-uffi.dll differ diff --git a/uffi/clsql-uffi.lib b/uffi/clsql-uffi.lib new file mode 100644 index 0000000..0a1bd6c Binary files /dev/null and b/uffi/clsql-uffi.lib differ