From: Kevin M. Rosenberg Date: Tue, 11 Nov 2003 15:28:36 +0000 (+0000) Subject: r8153: initial changes to make installable with asdf-install X-Git-Tag: v3.8.6~790 X-Git-Url: http://git.kpe.io/?p=clsql.git;a=commitdiff_plain;h=b31836193ceb646fa6e4fd7761dff378a9c67385 r8153: initial changes to make installable with asdf-install --- diff --git a/ChangeLog b/ChangeLog index 04dde1c..45929d0 100644 --- 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 diff --git a/clsql-mysql.asd b/clsql-mysql.asd index 06d9750..4fcd4eb 100644 --- a/clsql-mysql.asd +++ b/clsql-mysql.asd @@ -19,6 +19,41 @@ (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"))))) diff --git a/clsql-uffi.asd b/clsql-uffi.asd index 9cbfd70..ddd3c91 100644 --- a/clsql-uffi.asd +++ b/clsql-uffi.asd @@ -20,6 +20,40 @@ (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)) diff --git a/db-mysql/Makefile b/db-mysql/Makefile index 728c5ee..1f5ea48 100644 --- a/db-mysql/Makefile +++ b/db-mysql/Makefile @@ -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 # @@ -14,51 +12,23 @@ # 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 index ea11686..0000000 --- a/db-mysql/clsql-mysql.c +++ /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 - -BOOL WINAPI DllEntryPoint(HINSTANCE hinstdll, DWORD fdwReason, - LPVOID lpvReserved) -{ - return 1; -} - -#define DLLEXPORT __declspec(dllexport) - -#else -#define DLLEXPORT -#endif - - -#include - -/* 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 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 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 index 0000000..8ad0950 --- /dev/null +++ b/db-mysql/make.sh @@ -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 + + diff --git a/db-mysql/mysql-loader.lisp b/db-mysql/mysql-loader.lisp index 1dc903d..db40150 100644 --- a/db-mysql/mysql-loader.lisp +++ b/db-mysql/mysql-loader.lisp @@ -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 index 0000000..ea11686 --- /dev/null +++ b/db-mysql/mysql.c @@ -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 + +BOOL WINAPI DllEntryPoint(HINSTANCE hinstdll, DWORD fdwReason, + LPVOID lpvReserved) +{ + return 1; +} + +#define DLLEXPORT __declspec(dllexport) + +#else +#define DLLEXPORT +#endif + + +#include + +/* 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 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 index 0000000..49f942b Binary files /dev/null and b/db-mysql/mysql.lib differ diff --git a/debian/changelog b/debian/changelog index d02fc72..4c6ecc1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +cl-sql (1.8.0-1) unstable; urgency=low + + * Make asdf-installable + + -- Kevin M. Rosenberg Tue, 11 Nov 2003 08:06:28 -0700 + cl-sql (1.7.9-1) unstable; urgency=low * Add missing documentation file diff --git a/uffi/Makefile b/uffi/Makefile index c2d1b3d..0a0568f 100644 --- a/uffi/Makefile +++ b/uffi/Makefile @@ -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 # @@ -14,42 +12,23 @@ # 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 diff --git a/uffi/clsql-uffi-loader.lisp b/uffi/clsql-uffi-loader.lisp index c667746..a8f7173 100644 --- a/uffi/clsql-uffi-loader.lisp +++ b/uffi/clsql-uffi-loader.lisp @@ -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 index f1cfe08..0000000 --- a/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$ - * - * 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.dll b/uffi/clsql-uffi.dll deleted file mode 100644 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 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 index 0000000..f239372 --- /dev/null +++ b/uffi/make.sh @@ -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 index 0000000..f1cfe08 --- /dev/null +++ b/uffi/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$ + * + * 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/uffi.dll b/uffi/uffi.dll new file mode 100644 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 index 0000000..8dde929 Binary files /dev/null and b/uffi/uffi.lib differ