r8153: initial changes to make installable with asdf-install
authorKevin M. Rosenberg <kevin@rosenberg.net>
Tue, 11 Nov 2003 15:28:36 +0000 (15:28 +0000)
committerKevin M. Rosenberg <kevin@rosenberg.net>
Tue, 11 Nov 2003 15:28:36 +0000 (15:28 +0000)
22 files changed:
ChangeLog
clsql-mysql.asd
clsql-uffi.asd
db-mysql/Makefile
db-mysql/clsql-mysql.c [deleted file]
db-mysql/clsql-mysql.dll [deleted file]
db-mysql/clsql-mysql.lib [deleted file]
db-mysql/make.sh [new file with mode: 0644]
db-mysql/mysql-loader.lisp
db-mysql/mysql.c [new file with mode: 0644]
db-mysql/mysql.dll [new file with mode: 0644]
db-mysql/mysql.lib [new file with mode: 0644]
debian/changelog
uffi/Makefile
uffi/clsql-uffi-loader.lisp
uffi/clsql-uffi.c [deleted file]
uffi/clsql-uffi.dll [deleted file]
uffi/clsql-uffi.lib [deleted file]
uffi/make.sh [new file with mode: 0644]
uffi/uffi.c [new file with mode: 0644]
uffi/uffi.dll [new file with mode: 0644]
uffi/uffi.lib [new file with mode: 0644]

index 04dde1ceb5de8be36b824ae0d5fed4a0e5145d88..45929d0a394adc0b7f294d295c61ac6df9cec93b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+11 Nov 2003 Kevin Rosenberg (kevin@rosenberg.net)
+       * Converted documentation to XML format
+       * Made package installable with asdf-install
+
 23 Jul 2003 Kevin Rosenberg (kevin@rosenberg.net)
        * Add for-each-row macro
 
index 06d975036b9c09cfb8e51a9f19889f54f9ceb42b..4fcd4eb1a5c6514b3d05df8297155b5dc7406770 100644 (file)
 (defpackage #:clsql-mysql-system (:use #:asdf #:cl))
 (in-package #:clsql-mysql-system)
 
+(defvar *asd-file-dir* (pathname-directory *load-truename*))
+
+(defclass clsql-mysql-source-file (c-source-file)
+  ())
+
+(defmethod output-files ((o compile-op) (c clsql-mysql-source-file))
+  (let ((searched (or
+                  (probe-file #p"/usr/lib/clsql/uffi.so")
+                  (probe-file (make-pathname
+                               :directory *asd-file-dir*
+                               :name "uffi"
+                               :type "so")))))
+    (if searched
+       (list searched)
+       (list (merge-pathnames
+              (make-pathname :name (component-name c)
+                             :type "so"
+                             :directory '(:relative "tests"))
+              (make-pathname :directory *asd-file-dir*))))))
+
+(defmethod perform ((o load-op) (c clsql-mysql-source-file))
+  nil) ;;; library will be loaded by a loader file
+
+(defmethod perform ((o compile-op) (c clsql-mysql-source-file))
+  (unless (zerop (run-shell-command
+                 "cd ~A; make"
+                 (namestring (merge-pathnames
+                              (make-pathname
+                               :name nil
+                               :type nil
+                               :directory '(:relative "uffi"))
+                              (make-pathname
+                               :directory *asd-file-dir*)))))
+    (error 'operation-error :component c :operation o)))
+
 ;;; System definition
 
 #+(or allegro lispworks cmu sbcl openmcl mcl scl)
@@ -33,8 +68,9 @@
   :components
   ((:module :db-mysql
            :components
-           ((:file "mysql-package")
-            (:file "mysql-loader" :depends-on ("mysql-package"))
+           ((:clsql-mysql-source-file "mysql")
+            (:file "mysql-package")
+            (:file "mysql-loader" :depends-on ("mysql-package" "mysql"))
             (:file "mysql-api" :depends-on ("mysql-loader"))
             (:file "mysql-sql" :depends-on ("mysql-api"))
             (:file "mysql-usql" :depends-on ("mysql-sql")))))
index 9cbfd70d09e42655653f1ad14b4cf963b0bba4da..ddd3c912dd5e124fe779618e6447cb0c432ee5d5 100644 (file)
 (defpackage #:clsql-uffi-system (:use #:asdf #:cl))
 (in-package #:clsql-uffi-system)
 
+(defvar *asd-file-dir* (pathname-directory *load-truename*))
+
+(defclass clsql-uffi-source-file (c-source-file)
+  ())
+
+(defmethod output-files ((o compile-op) (c clsql-uffi-source-file))
+  (let ((searched (or
+                  (probe-file #p"/usr/lib/clsql/uffi.so")
+                  (probe-file (make-pathname
+                               :directory *asd-file-dir*
+                               :name "uffi"
+                               :type "so")))))
+    (if searched
+       (list searched)
+       (list (merge-pathnames
+              (make-pathname :name (component-name c)
+                             :type "so"
+                             :directory '(:relative "tests"))
+              (make-pathname :directory *asd-file-dir*))))))
+
+(defmethod perform ((o load-op) (c clsql-uffi-source-file))
+  nil) ;;; library will be loaded by a loader file
+
+(defmethod perform ((o compile-op) (c clsql-uffi-source-file))
+  (unless (zerop (run-shell-command
+                 "cd ~A; make"
+                 (namestring (merge-pathnames
+                              (make-pathname
+                               :name nil
+                               :type nil
+                               :directory '(:relative "uffi"))
+                              (make-pathname
+                               :directory *asd-file-dir*)))))
+    (error 'operation-error :component c :operation o)))
 
 #+(or allegro lispworks cmu sbcl openmcl mcl scl)
 (defsystem clsql-uffi
@@ -33,7 +67,8 @@
   :components
   ((:module :uffi
            :components
-           ((:file "clsql-uffi-package")
-            (:file "clsql-uffi-loader" :depends-on ("clsql-uffi-package"))
+           ((:clsql-uffi-source-file "uffi")
+            (:file "clsql-uffi-package")
+            (:file "clsql-uffi-loader" :depends-on ("clsql-uffi-package" "uffi"))
             (:file "clsql-uffi" :depends-on ("clsql-uffi-loader")))))
   :depends-on (:uffi :clsql-base))
index 728c5ee873d68a49c5e50032f1dfea834334b4c1..1f5ea483c5ed92d539b6f382403d89491bb0d0b3 100644 (file)
@@ -1,9 +1,7 @@
-# -*- Mode: Makefile -*-
-###########################################################################
 # FILE IDENTIFICATION
-# 
+#
 #  Name:         Makefile
-#  Purpose:      Makefile for the CLSQL MySQL database interface
+#  Purpose:      Makefile for CLSQL MySQL interface
 #  Programer:    Kevin M. Rosenberg
 #  Date Started: Mar 2002
 #
 # 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
-LD=gcc
-
-# Use these for Sun's C compiler and Solaris (ACL)
-#CC=cc
-#SHARED_CC_OPT=-KPIC
-#SHARED_LD_OPT=-G
-#LD=ld
 
-# May need to change to the directory where you have installed mysql's library
-vpath %.so /usr/lib /usr/local/lib /opt/mysql/lib/mysql
-vpath %.h /usr/include /usr/include/mysql /usr/local/include /usr/local/include/mysql /opt/mysql/include/mysql
-INCLUDE_DIRS=-I/usr/include/mysql -I/usr/local/include/mysql -I/opt/mysql/include/mysql -I/usr/include -I/usr/local/include
+SUBDIRS=
 
-# Nothing to configure beyond this point
+include ../Makefile.common
 
-base=clsql-mysql
+base=mysql
 source=$(base).c
 object=$(base).o
 shared_lib=$(base).so
 
-.PHONY: all clean distclean
-
-all: compile
-
-compile: $(shared_lib)
+.PHONY: all
+all: $(shared_lib)
 
-$(object): $(source) mysql.h
-       $(CC) ${SHARED_CC_OPT} $(INCLUDE_DIRS) -c $< -o $@
-
-$(shared_lib): $(object) 
-       $(LD) ${SHARED_LD_OPT} $^ -o $@
-
-mac: $(object)
-       ld -bundle /usr/lib/bundle1.o -flat_namespace -undefined suppress $(object) -o $(base).dylib
-       ld -bundle /usr/lib/bundle1.o -flat_namespace -undefined suppress /sw/lib/libmysqlclient.dylib -o libmysqlclient.dylib
-       ld -bundle /usr/lib/bundle1.o -flat_namespace -undefined suppress /usr/lib/libz.dylib -o libz.dylib
-
-clean:
-       @rm -f $(object) $(shared_lib) *~
+$(shared_lib): $(source) Makefile
+       CFLAGS="-I /usr/include/mysql" LDFLAGS="-lmysqlclient" BASE=$(base) OBJECT=$(object) SOURCE=$(source) SHARED_LIB=$(shared_lib) sh make.sh
+       rm $(object)
 
+.PHONY: distclean
 distclean: clean
-
+       rm -f $(base).dylib $(base).dylib $(base).so $(base).o
diff --git a/db-mysql/clsql-mysql.c b/db-mysql/clsql-mysql.c
deleted file mode 100644 (file)
index ea11686..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-/****************************************************************************
- * FILE IDENTIFICATION
- *
- *   Name:          clsql-mysql.c
- *   Purpose:       Helper functions for mysql.cl to handle 64-bit parts of API
- *   Programmer:    Kevin M. Rosenberg
- *   Date Started:  Mar 2002
- *
- * $Id$
- *
- * 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 <windows.h>
-
-BOOL WINAPI DllEntryPoint(HINSTANCE hinstdll, DWORD fdwReason,
-                         LPVOID lpvReserved)
-{
-        return 1;
-}
-       
-#define DLLEXPORT __declspec(dllexport)
-
-#else
-#define DLLEXPORT 
-#endif
-
-
-#include <mysql.h>
-
-/* Need to assemble a 64-bit integer to send to MySQL */
-DLLEXPORT
-void
-clsql_mysql_data_seek (MYSQL_RES* res, unsigned int offset_high32,
-                      unsigned int offset_low32)
-{
-  my_ulonglong offset;
-
-  offset = offset_high32;
-  offset = offset << 32;
-  offset += offset_low32;
-  
-  mysql_data_seek (res, offset);
-}
-
-/* The following functions are used to return 64-bit integers to Lisp.
-   They return the 32-bit low part and store in upper 32-bits in a 
-   located sent via a pointer */
-
-static const unsigned int bitmask_32bits = 0xFFFFFFFF;
-#define lower_32bits(int64) ((unsigned int) int64 & bitmask_32bits)
-#define upper_32bits(int64) ((unsigned int) (int64 >> 32))
-
-DLLEXPORT
-unsigned int
-clsql_mysql_num_rows (MYSQL_RES* res, unsigned int* pHigh32)
-{
-  my_ulonglong nRows = mysql_num_rows (res);
-  *pHigh32 = upper_32bits(nRows);
-  return lower_32bits(nRows);
-}
-
-DLLEXPORT
-unsigned int
-clsql_mysql_affected_rows (MYSQL* res, unsigned int* pHigh32)
-{
-  my_ulonglong nAffected = mysql_affected_rows (res);
-  *pHigh32 = upper_32bits(nAffected);
-  return lower_32bits(nAffected);
-}
-
-DLLEXPORT
-unsigned int
-clsql_mysql_insert_id (MYSQL* mysql, unsigned int* pHigh32)
-{
-  my_ulonglong insert_id = mysql_insert_id (mysql);
-  *pHigh32 = upper_32bits(insert_id);
-  return lower_32bits(insert_id);
-}
-
-
diff --git a/db-mysql/clsql-mysql.dll b/db-mysql/clsql-mysql.dll
deleted file mode 100644 (file)
index 9725932..0000000
Binary files a/db-mysql/clsql-mysql.dll and /dev/null differ
diff --git a/db-mysql/clsql-mysql.lib b/db-mysql/clsql-mysql.lib
deleted file mode 100644 (file)
index 49f942b..0000000
Binary files a/db-mysql/clsql-mysql.lib and /dev/null differ
diff --git a/db-mysql/make.sh b/db-mysql/make.sh
new file mode 100644 (file)
index 0000000..8ad0950
--- /dev/null
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+UNAME=`uname -a`
+LINUX=`expr "$UNAME" : '.*Linux.*'`
+DARWIN=`expr "$UNAME" : '.*Darwin.*'`
+SOLARIS=`expr "$UNAME" : '.*sun4u.*'`
+AIX=`expr "$UNAME" : '.*aix.*'`
+
+
+if [ $LINUX -ne 0 ]; then
+    gcc -fPIC -DPIC $CFLAGS -c $SOURCE -o $OBJECT
+    gcc -shared $OBJECT $LDFLAGS -o $SHARED_LIB
+    #gcc -shared -Wl,-soname,uffi-c-test-lib $OBJECT -o $SHARED_LIB
+elif [ $DARWIN -ne 0 ]; then
+    cc -dynamic $CFLAGS -c $SOURCE -o $OBJECT
+    ld -bundle /usr/lib/bundle1.o -flat_namespace -undefined suppress -o $BASE.dylib $OBJECT $LDFLAGS
+    ld -bundle /usr/lib/bundle1.o -flat_namespace -undefined suppress /usr/lib/libz.dylib -o z.dylib
+elif [ $SOLARIS -ne 0 ]; then
+    cc -KPIC $CFLAGS -c $SOURCE -o $OBJECT
+    cc -G $OBJECT  $LDFLAGS -o $SHARED_LIB
+elif [ $AIX -ne 0 ]; then
+    gcc $CFLAGS -c -D_BSD -D_NO_PROTO -D_NONSTD_TYPES -D_MBI=void $SOURCE
+    make_shared  $LDFLAGS -o $SHARED_LIB $OBJECT
+fi
+
+
index 1dc903daf1963e51aca9172fee33264531174ff4..db401500c41bbbbc931191b6458dd17c695e47c9 100644 (file)
@@ -27,7 +27,7 @@
 
 (defparameter *clsql-mysql-library-path* 
   (uffi:find-foreign-library
-   "clsql-mysql"
+   "mysql"
    `(,(make-pathname :directory (pathname-directory *load-truename*))
      "/usr/lib/clsql/"
      "/sw/lib/clsql/"
diff --git a/db-mysql/mysql.c b/db-mysql/mysql.c
new file mode 100644 (file)
index 0000000..ea11686
--- /dev/null
@@ -0,0 +1,86 @@
+/****************************************************************************
+ * FILE IDENTIFICATION
+ *
+ *   Name:          clsql-mysql.c
+ *   Purpose:       Helper functions for mysql.cl to handle 64-bit parts of API
+ *   Programmer:    Kevin M. Rosenberg
+ *   Date Started:  Mar 2002
+ *
+ * $Id$
+ *
+ * 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 <windows.h>
+
+BOOL WINAPI DllEntryPoint(HINSTANCE hinstdll, DWORD fdwReason,
+                         LPVOID lpvReserved)
+{
+        return 1;
+}
+       
+#define DLLEXPORT __declspec(dllexport)
+
+#else
+#define DLLEXPORT 
+#endif
+
+
+#include <mysql.h>
+
+/* Need to assemble a 64-bit integer to send to MySQL */
+DLLEXPORT
+void
+clsql_mysql_data_seek (MYSQL_RES* res, unsigned int offset_high32,
+                      unsigned int offset_low32)
+{
+  my_ulonglong offset;
+
+  offset = offset_high32;
+  offset = offset << 32;
+  offset += offset_low32;
+  
+  mysql_data_seek (res, offset);
+}
+
+/* The following functions are used to return 64-bit integers to Lisp.
+   They return the 32-bit low part and store in upper 32-bits in a 
+   located sent via a pointer */
+
+static const unsigned int bitmask_32bits = 0xFFFFFFFF;
+#define lower_32bits(int64) ((unsigned int) int64 & bitmask_32bits)
+#define upper_32bits(int64) ((unsigned int) (int64 >> 32))
+
+DLLEXPORT
+unsigned int
+clsql_mysql_num_rows (MYSQL_RES* res, unsigned int* pHigh32)
+{
+  my_ulonglong nRows = mysql_num_rows (res);
+  *pHigh32 = upper_32bits(nRows);
+  return lower_32bits(nRows);
+}
+
+DLLEXPORT
+unsigned int
+clsql_mysql_affected_rows (MYSQL* res, unsigned int* pHigh32)
+{
+  my_ulonglong nAffected = mysql_affected_rows (res);
+  *pHigh32 = upper_32bits(nAffected);
+  return lower_32bits(nAffected);
+}
+
+DLLEXPORT
+unsigned int
+clsql_mysql_insert_id (MYSQL* mysql, unsigned int* pHigh32)
+{
+  my_ulonglong insert_id = mysql_insert_id (mysql);
+  *pHigh32 = upper_32bits(insert_id);
+  return lower_32bits(insert_id);
+}
+
+
diff --git a/db-mysql/mysql.dll b/db-mysql/mysql.dll
new file mode 100644 (file)
index 0000000..9725932
Binary files /dev/null and b/db-mysql/mysql.dll differ
diff --git a/db-mysql/mysql.lib b/db-mysql/mysql.lib
new file mode 100644 (file)
index 0000000..49f942b
Binary files /dev/null and b/db-mysql/mysql.lib differ
index d02fc72d7361d58ba1e155ede3652248c3283e82..4c6ecc1207f596d00dffa391f54d5de3ba0ae610 100644 (file)
@@ -1,3 +1,9 @@
+cl-sql (1.8.0-1) unstable; urgency=low
+
+  * Make asdf-installable
+
+ -- Kevin M. Rosenberg <kmr@debian.org>  Tue, 11 Nov 2003 08:06:28 -0700
+
 cl-sql (1.7.9-1) unstable; urgency=low
 
   * Add missing documentation file
index c2d1b3d007208543526d43f2a0f071b0203d0944..0a0568f26bf25084c53d36444836d792fdb8f3b4 100644 (file)
@@ -1,9 +1,7 @@
-# -*- Mode: Makefile -*-
-###########################################################################
 # FILE IDENTIFICATION
-# 
+#
 #  Name:         Makefile
-#  Purpose:      Makefile for the CLSQL UFFI helper package
+#  Purpose:      Makefile for CLSQL UFFI interface
 #  Programer:    Kevin M. Rosenberg
 #  Date Started: Mar 2002
 #
 # 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
+SUBDIRS=
 
-# Nothing to configure beyond this point
+include ../Makefile.common
 
-base=clsql-uffi
+base=uffi
 source=$(base).c
 object=$(base).o
 shared_lib=$(base).so
 
-.PHONY: all clean distclean
-
+.PHONY: all
 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) *~
+       BASE=$(base) OBJECT=$(object) SOURCE=$(source) SHARED_LIB=$(shared_lib) sh make.sh
+       rm $(object)
 
+.PHONY: distclean
 distclean: clean
-
-mac: $(source) Makefile
-       cc -dynamic -c $(source) -o $(object)
-       ld -bundle /usr/lib/bundle1.o -flat_namespace -undefined suppress -o $(base).dylib $(object)
+       rm -f $(base).dylib $(base).dylib $(base).so $(base).o
index c667746e0f3a6034cf044aeedf8e269ba2b7c2f9..a8f7173a84ea4657004f40a9f4fec9f75426e7b8 100644 (file)
@@ -20,7 +20,7 @@
 
 (defvar *clsql-uffi-library-filename* 
   (uffi:find-foreign-library
-   "clsql-uffi"
+   "uffi"
    `(,(make-pathname :directory (pathname-directory *load-truename*))
      "/usr/lib/clsql/"
      "/opt/lisp/clsql/uffi/"
@@ -37,7 +37,7 @@ set to the right path before compiling or loading the system.")
 
 (defun load-uffi-foreign-library ()
   (unless (probe-file *clsql-uffi-library-filename*)
-    (error "Unable to find clsql-uffi.so"))
+    (error "Unable to find uffi.so"))
   
   (if (uffi:load-foreign-library *clsql-uffi-library-filename* 
                                 :module "clsql-uffi" 
@@ -48,5 +48,3 @@ set to the right path before compiling or loading the system.")
 
 (load-uffi-foreign-library)
 
-
-
diff --git a/uffi/clsql-uffi.c b/uffi/clsql-uffi.c
deleted file mode 100644 (file)
index f1cfe08..0000000
+++ /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$
- *
- * 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 <windows.h>
-
-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.dll b/uffi/clsql-uffi.dll
deleted file mode 100644 (file)
index b9d7cfa..0000000
Binary files a/uffi/clsql-uffi.dll and /dev/null differ
diff --git a/uffi/clsql-uffi.lib b/uffi/clsql-uffi.lib
deleted file mode 100644 (file)
index 8dde929..0000000
Binary files a/uffi/clsql-uffi.lib and /dev/null differ
diff --git a/uffi/make.sh b/uffi/make.sh
new file mode 100644 (file)
index 0000000..f239372
--- /dev/null
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+UNAME=`uname -a`
+LINUX=`expr "$UNAME" : '.*Linux.*'`
+DARWIN=`expr "$UNAME" : '.*Darwin.*'`
+SOLARIS=`expr "$UNAME" : '.*sun4u.*'`
+AIX=`expr "$UNAME" : '.*aix.*'`
+
+
+if [ $LINUX -ne 0 ]; then
+    gcc -fPIC -DPIC -c $SOURCE -o $OBJECT
+    gcc -shared $OBJECT -o $SHARED_LIB
+    #gcc -shared -Wl,-soname,uffi-c-test-lib $OBJECT -o $SHARED_LIB
+elif [ $DARWIN -ne 0 ]; then
+    cc -dynamic -c $SOURCE -o $OBJECT
+    ld -bundle /usr/lib/bundle1.o -flat_namespace -undefined suppress -o $BASE.dylib $OBJECT
+    ld -bundle /usr/lib/bundle1.o -flat_namespace -undefined suppress /usr/lib/libz.dylib -o z.dylib
+elif [ $SOLARIS -ne 0 ]; then
+    cc -KPIC -c $SOURCE -o $OBJECT
+    cc -G $OBJECT -o $SHARED_LIB
+elif [ $AIX -ne 0 ]; then
+    gcc -c -D_BSD -D_NO_PROTO -D_NONSTD_TYPES -D_MBI=void $SOURCE
+    make_shared -o $SHARED_LIB $OBJECT
+fi
+
+
diff --git a/uffi/uffi.c b/uffi/uffi.c
new file mode 100644 (file)
index 0000000..f1cfe08
--- /dev/null
@@ -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$
+ *
+ * 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 <windows.h>
+
+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/uffi.dll b/uffi/uffi.dll
new file mode 100644 (file)
index 0000000..b9d7cfa
Binary files /dev/null and b/uffi/uffi.dll differ
diff --git a/uffi/uffi.lib b/uffi/uffi.lib
new file mode 100644 (file)
index 0000000..8dde929
Binary files /dev/null and b/uffi/uffi.lib differ