From bc5968d54cee0416db7db9ee2c7295489170bccf Mon Sep 17 00:00:00 2001 From: "Kevin M. Rosenberg" Date: Sat, 9 Mar 2002 21:19:31 +0000 Subject: [PATCH] r1520: *** empty log message *** --- ChangeLog | 3 +++ Makefile | 4 ++-- doc/ref.sgml | 2 +- examples/compress.cl | 4 ++-- examples/getenv.cl | 4 ++-- examples/gethostname.cl | 4 ++-- examples/getshells.cl | 8 ++++---- examples/gettime.cl | 6 +++--- examples/strtol.cl | 4 ++-- src/routine.cl | 7 ++++--- tests/compress.cl | 4 ++-- tests/getenv.cl | 4 ++-- tests/gethostname.cl | 4 ++-- tests/getshells.cl | 8 ++++---- tests/gettime.cl | 6 +++--- tests/strtol.cl | 4 ++-- 16 files changed, 40 insertions(+), 36 deletions(-) diff --git a/ChangeLog b/ChangeLog index a2afd22..153f535 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,3 +3,6 @@ - Modified def-enum to use uffi:def-constant rather than cl:defconstant +9 Mar 2002 + - Changed def-routine name to def-function + - Fixed bug in def-function for Lispworks diff --git a/Makefile b/Makefile index 906fad8..fdbd5ad 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ # Programer: Kevin M. Rosenberg, M.D. # Date Started: Mar 2002 # -# CVS Id: $Id: Makefile,v 1.2 2002/03/09 20:32:05 kevin Exp $ +# CVS Id: $Id: Makefile,v 1.3 2002/03/09 21:19:31 kevin Exp $ # # Copyright (c) 2002 by Kevin M. Rosenberg # @@ -41,7 +41,7 @@ realclean: clean docs: @(cd doc; make dist-doc) -VERSION=0.1.1 +VERSION=0.1.2 DISTDIR=uffi-${VERSION} DIST_TARBALL=${DISTDIR}.tar.gz DIST_ZIP=${DISTDIR}.zip diff --git a/doc/ref.sgml b/doc/ref.sgml index 549a4eb..5b783d3 100644 --- a/doc/ref.sgml +++ b/doc/ref.sgml @@ -228,7 +228,7 @@ Routine - def-routine + def-function This macro generates a &c; routine definition. diff --git a/examples/compress.cl b/examples/compress.cl index cf3bec4..7787b69 100644 --- a/examples/compress.cl +++ b/examples/compress.cl @@ -9,7 +9,7 @@ ;;;; ;;;; Copyright (c) 2002 Kevin M. Rosenberg ;;;; -;;;; $Id: compress.cl,v 1.1 2002/03/09 19:55:33 kevin Exp $ +;;;; $Id: compress.cl,v 1.2 2002/03/09 21:19:31 kevin Exp $ ;;;; ;;;; This file is part of UFFI. ;;;; @@ -32,7 +32,7 @@ (unless (uffi:load-foreign-library "/usr/lib/libz.so" "zlib" '("c")) (warn "Unable to load zlib")) -(uffi:def-routine ("compress" c-compress) +(uffi:def-function ("compress" c-compress) ((dest (* :unsigned-char)) (destlen (* :long)) (source :c-string) diff --git a/examples/getenv.cl b/examples/getenv.cl index 3a565c2..335a70f 100644 --- a/examples/getenv.cl +++ b/examples/getenv.cl @@ -9,7 +9,7 @@ ;;;; ;;;; Copyright (c) 2002 Kevin M. Rosenberg ;;;; -;;;; $Id: getenv.cl,v 1.1 2002/03/09 19:55:33 kevin Exp $ +;;;; $Id: getenv.cl,v 1.2 2002/03/09 21:19:31 kevin Exp $ ;;;; ;;;; This file is part of UFFI. ;;;; @@ -30,7 +30,7 @@ (in-package :cl-user) -(uffi:def-routine ("getenv" c-getenv) +(uffi:def-function ("getenv" c-getenv) ((name :c-string)) :returning :c-string) diff --git a/examples/gethostname.cl b/examples/gethostname.cl index 4916ed3..0b3ceda 100644 --- a/examples/gethostname.cl +++ b/examples/gethostname.cl @@ -9,7 +9,7 @@ ;;;; ;;;; Copyright (c) 2002 Kevin M. Rosenberg ;;;; -;;;; $Id: gethostname.cl,v 1.1 2002/03/09 19:55:33 kevin Exp $ +;;;; $Id: gethostname.cl,v 1.2 2002/03/09 21:19:31 kevin Exp $ ;;;; ;;;; This file is part of UFFI. ;;;; @@ -32,7 +32,7 @@ ;;; This example is inspired by the example on the CL-Cookbook web site -(uffi:def-routine ("gethostname" c-gethostname) +(uffi:def-function ("gethostname" c-gethostname) ((name :c-string) (len :int)) :returning :int) diff --git a/examples/getshells.cl b/examples/getshells.cl index 92ecc8b..58e1020 100644 --- a/examples/getshells.cl +++ b/examples/getshells.cl @@ -9,7 +9,7 @@ ;;;; ;;;; Copyright (c) 2002 Kevin M. Rosenberg ;;;; -;;;; $Id: getshells.cl,v 1.1 2002/03/09 19:55:33 kevin Exp $ +;;;; $Id: getshells.cl,v 1.2 2002/03/09 21:19:31 kevin Exp $ ;;;; ;;;; This file is part of UFFI. ;;;; @@ -30,15 +30,15 @@ (in-package :cl-user) -(uffi:def-routine "setusershell" +(uffi:def-function "setusershell" nil :returning :void) -(uffi:def-routine "endusershell" +(uffi:def-function "endusershell" nil :returning :void) -(uffi:def-routine "getusershell" +(uffi:def-function "getusershell" nil :returning :c-string) diff --git a/examples/gettime.cl b/examples/gettime.cl index a26e57e..ea71edc 100644 --- a/examples/gettime.cl +++ b/examples/gettime.cl @@ -9,7 +9,7 @@ ;;;; ;;;; Copyright (c) 2002 Kevin M. Rosenberg ;;;; -;;;; $Id: gettime.cl,v 1.1 2002/03/09 19:55:33 kevin Exp $ +;;;; $Id: gettime.cl,v 1.2 2002/03/09 21:19:31 kevin Exp $ ;;;; ;;;; This file is part of UFFI. ;;;; @@ -42,11 +42,11 @@ (yday :int) (isdst :int)) -(uffi:def-routine ("time" c-time) +(uffi:def-function ("time" c-time) ((time (* time-t))) :returning time-t) -(uffi:def-routine ("localtime" c-localtime) +(uffi:def-function ("localtime" c-localtime) ((time (* time-t))) :returning (* tm)) diff --git a/examples/strtol.cl b/examples/strtol.cl index 8505422..3655dd0 100644 --- a/examples/strtol.cl +++ b/examples/strtol.cl @@ -9,7 +9,7 @@ ;;;; ;;;; Copyright (c) 2002 Kevin M. Rosenberg ;;;; -;;;; $Id: strtol.cl,v 1.1 2002/03/09 19:55:33 kevin Exp $ +;;;; $Id: strtol.cl,v 1.2 2002/03/09 21:19:31 kevin Exp $ ;;;; ;;;; This file is part of UFFI. ;;;; @@ -35,7 +35,7 @@ ;; the routine needs to do pointer arithmetic to see how many characters ;; were parsed -(uffi:def-routine ("strtol" c-strtol) +(uffi:def-function ("strtol" c-strtol) ((nptr (* :char)) (endptr (* char-ptr)) (base :int)) diff --git a/src/routine.cl b/src/routine.cl index ddbc4db..9dd7aa4 100644 --- a/src/routine.cl +++ b/src/routine.cl @@ -2,14 +2,14 @@ ;;;; ************************************************************************* ;;;; FILE IDENTIFICATION ;;;; -;;;; Name: routine.cl +;;;; Name: function.cl ;;;; Purpose: UFFI source to C function defintions ;;;; Programmer: Kevin M. Rosenberg ;;;; Date Started: Feb 2002 ;;;; ;;;; Copyright (c) 2002 Kevin M. Rosenberg ;;;; -;;;; $Id: routine.cl,v 1.1 2002/03/09 19:55:33 kevin Exp $ +;;;; $Id: routine.cl,v 1.2 2002/03/09 21:19:31 kevin Exp $ ;;;; ;;;; This file is part of the UFFI. ;;;; @@ -58,7 +58,7 @@ ;; name is either a string representing foreign name, or a list ;; of foreign-name as a string and lisp name as a symbol -(defmacro def-routine (names args &key module returning) +(defmacro def-function (names args &key module returning) #+(or cmu allegro) (declare (ignore module)) (let* ((result-type (convert-from-uffi-type returning :return)) @@ -80,6 +80,7 @@ `(fli:define-foreign-function (,lisp-name ,foreign-name :object) ,function-args ,@(if module (list :module module) (values)) + :result-type ,result-type :calling-convention :cdecl) )) diff --git a/tests/compress.cl b/tests/compress.cl index cf3bec4..7787b69 100644 --- a/tests/compress.cl +++ b/tests/compress.cl @@ -9,7 +9,7 @@ ;;;; ;;;; Copyright (c) 2002 Kevin M. Rosenberg ;;;; -;;;; $Id: compress.cl,v 1.1 2002/03/09 19:55:33 kevin Exp $ +;;;; $Id: compress.cl,v 1.2 2002/03/09 21:19:31 kevin Exp $ ;;;; ;;;; This file is part of UFFI. ;;;; @@ -32,7 +32,7 @@ (unless (uffi:load-foreign-library "/usr/lib/libz.so" "zlib" '("c")) (warn "Unable to load zlib")) -(uffi:def-routine ("compress" c-compress) +(uffi:def-function ("compress" c-compress) ((dest (* :unsigned-char)) (destlen (* :long)) (source :c-string) diff --git a/tests/getenv.cl b/tests/getenv.cl index 3a565c2..335a70f 100644 --- a/tests/getenv.cl +++ b/tests/getenv.cl @@ -9,7 +9,7 @@ ;;;; ;;;; Copyright (c) 2002 Kevin M. Rosenberg ;;;; -;;;; $Id: getenv.cl,v 1.1 2002/03/09 19:55:33 kevin Exp $ +;;;; $Id: getenv.cl,v 1.2 2002/03/09 21:19:31 kevin Exp $ ;;;; ;;;; This file is part of UFFI. ;;;; @@ -30,7 +30,7 @@ (in-package :cl-user) -(uffi:def-routine ("getenv" c-getenv) +(uffi:def-function ("getenv" c-getenv) ((name :c-string)) :returning :c-string) diff --git a/tests/gethostname.cl b/tests/gethostname.cl index 4916ed3..0b3ceda 100644 --- a/tests/gethostname.cl +++ b/tests/gethostname.cl @@ -9,7 +9,7 @@ ;;;; ;;;; Copyright (c) 2002 Kevin M. Rosenberg ;;;; -;;;; $Id: gethostname.cl,v 1.1 2002/03/09 19:55:33 kevin Exp $ +;;;; $Id: gethostname.cl,v 1.2 2002/03/09 21:19:31 kevin Exp $ ;;;; ;;;; This file is part of UFFI. ;;;; @@ -32,7 +32,7 @@ ;;; This example is inspired by the example on the CL-Cookbook web site -(uffi:def-routine ("gethostname" c-gethostname) +(uffi:def-function ("gethostname" c-gethostname) ((name :c-string) (len :int)) :returning :int) diff --git a/tests/getshells.cl b/tests/getshells.cl index 92ecc8b..58e1020 100644 --- a/tests/getshells.cl +++ b/tests/getshells.cl @@ -9,7 +9,7 @@ ;;;; ;;;; Copyright (c) 2002 Kevin M. Rosenberg ;;;; -;;;; $Id: getshells.cl,v 1.1 2002/03/09 19:55:33 kevin Exp $ +;;;; $Id: getshells.cl,v 1.2 2002/03/09 21:19:31 kevin Exp $ ;;;; ;;;; This file is part of UFFI. ;;;; @@ -30,15 +30,15 @@ (in-package :cl-user) -(uffi:def-routine "setusershell" +(uffi:def-function "setusershell" nil :returning :void) -(uffi:def-routine "endusershell" +(uffi:def-function "endusershell" nil :returning :void) -(uffi:def-routine "getusershell" +(uffi:def-function "getusershell" nil :returning :c-string) diff --git a/tests/gettime.cl b/tests/gettime.cl index a26e57e..ea71edc 100644 --- a/tests/gettime.cl +++ b/tests/gettime.cl @@ -9,7 +9,7 @@ ;;;; ;;;; Copyright (c) 2002 Kevin M. Rosenberg ;;;; -;;;; $Id: gettime.cl,v 1.1 2002/03/09 19:55:33 kevin Exp $ +;;;; $Id: gettime.cl,v 1.2 2002/03/09 21:19:31 kevin Exp $ ;;;; ;;;; This file is part of UFFI. ;;;; @@ -42,11 +42,11 @@ (yday :int) (isdst :int)) -(uffi:def-routine ("time" c-time) +(uffi:def-function ("time" c-time) ((time (* time-t))) :returning time-t) -(uffi:def-routine ("localtime" c-localtime) +(uffi:def-function ("localtime" c-localtime) ((time (* time-t))) :returning (* tm)) diff --git a/tests/strtol.cl b/tests/strtol.cl index 8505422..3655dd0 100644 --- a/tests/strtol.cl +++ b/tests/strtol.cl @@ -9,7 +9,7 @@ ;;;; ;;;; Copyright (c) 2002 Kevin M. Rosenberg ;;;; -;;;; $Id: strtol.cl,v 1.1 2002/03/09 19:55:33 kevin Exp $ +;;;; $Id: strtol.cl,v 1.2 2002/03/09 21:19:31 kevin Exp $ ;;;; ;;;; This file is part of UFFI. ;;;; @@ -35,7 +35,7 @@ ;; the routine needs to do pointer arithmetic to see how many characters ;; were parsed -(uffi:def-routine ("strtol" c-strtol) +(uffi:def-function ("strtol" c-strtol) ((nptr (* :char)) (endptr (* char-ptr)) (base :int)) -- 2.34.1