- 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
# 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
#
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
<sect1>
<title>Routine</title>
<sect2>
- <title>def-routine</title>
+ <title>def-function</title>
<para>
This macro generates a &c; routine definition.
</para>
;;;;
;;;; 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.
;;;;
(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)
;;;;
;;;; 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.
;;;;
(in-package :cl-user)
-(uffi:def-routine ("getenv" c-getenv)
+(uffi:def-function ("getenv" c-getenv)
((name :c-string))
:returning :c-string)
;;;;
;;;; 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.
;;;;
;;; 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)
;;;;
;;;; 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.
;;;;
(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)
;;;;
;;;; 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.
;;;;
(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))
;;;;
;;;; 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.
;;;;
;; 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))
;;;; *************************************************************************
;;;; 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.
;;;;
;; 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))
`(fli:define-foreign-function (,lisp-name ,foreign-name :object)
,function-args
,@(if module (list :module module) (values))
+ :result-type ,result-type
:calling-convention :cdecl)
))
;;;;
;;;; 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.
;;;;
(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)
;;;;
;;;; 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.
;;;;
(in-package :cl-user)
-(uffi:def-routine ("getenv" c-getenv)
+(uffi:def-function ("getenv" c-getenv)
((name :c-string))
:returning :c-string)
;;;;
;;;; 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.
;;;;
;;; 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)
;;;;
;;;; 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.
;;;;
(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)
;;;;
;;;; 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.
;;;;
(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))
;;;;
;;;; 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.
;;;;
;; 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))