r1613: Updated to use stack allocation
authorKevin M. Rosenberg <kevin@rosenberg.net>
Thu, 21 Mar 2002 16:47:59 +0000 (16:47 +0000)
committerKevin M. Rosenberg <kevin@rosenberg.net>
Thu, 21 Mar 2002 16:47:59 +0000 (16:47 +0000)
ChangeLog
Makefile
src/objects.cl

index fe54d30af0e8c97ebd0e131d26ef6afb7e2ca0f9..300f25e5c4a804b73f9fac2fe708b82a8c8b5c1d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -16,6 +16,7 @@ See TODO file -- actively maintained. Includes changes that you
        * Added gethostname2 to examples/gethostname.cl which uses with-foreign-object
        * Added char-array-to-pointer function to encapsulate converting a char array
        to a pointer to char
+       * Converted with-foreign-object to use stack allocation on CMUCL and LW
        
 20 Mar 2002
        * Updated strings.cl so that foreign-strings are always unsigned.
index 6be1b72e0ce309a28bc23496fad402e696b8889e..52b3aab80b5ebccb0758def08ff210fead8494b5 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -5,7 +5,7 @@
 #  Programer:    Kevin M. Rosenberg, M.D.
 #  Date Started: Mar 2002
 #
-#  CVS Id:   $Id: Makefile,v 1.27 2002/03/21 14:49:14 kevin Exp $
+#  CVS Id:   $Id: Makefile,v 1.28 2002/03/21 16:47:59 kevin Exp $
 #
 # This file, part of UFFI, is Copyright (c) 2002 by Kevin M. Rosenberg
 #
@@ -31,7 +31,7 @@ realclean: clean
 docs:
        @(cd doc; make dist-doc)
 
-VERSION=0.2.11
+VERSION=0.2.12
 DISTDIR=uffi-${VERSION}
 DIST_TARBALL=${DISTDIR}.tar.gz
 DIST_ZIP=${DISTDIR}.zip
index 7f10ab5ba30124e4a08f5e43edf5b7b4c3abbff8..6a33f9b1cc04a9b145e6c27924ad13ddbef7d4e0 100644 (file)
@@ -1,4 +1,4 @@
-;;;; -*- Mode: ANSI-Lisp; Syntax: ANSI-Common-Lisp; Base: 10 -*-
+;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10 -*-
 ;;;; *************************************************************************
 ;;;; FILE IDENTIFICATION
 ;;;;
@@ -7,7 +7,7 @@
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Feb 2002
 ;;;;
-;;;; $Id: objects.cl,v 1.12 2002/03/21 15:57:01 kevin Exp $
+;;;; $Id: objects.cl,v 1.13 2002/03/21 16:47:46 kevin Exp $
 ;;;;
 ;;;; This file, part of UFFI, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;;
@@ -109,11 +109,20 @@ an array of TYPE with size SIZE."
 
 ;; Simple first pass. Will later create optimized routines for
 ;; various platforms.
-(defmacro with-foreign-object ((var type &rest etc) &rest body)
-  `(let ((,var (allocate-foreign-object ,type ,@etc)))
+(defmacro with-foreign-object ((var type) &rest body)
+  #+allegro
+  `(let ((,var (allocate-foreign-object ,type)))
     (unwind-protect
         (progn ,@body)
-      (free-foreign-object ,var))))
+      (free-foreign-object ,var)))
+  #+cmu
+  `(alien:with-alien ((,var ,(convert-from-uffi-type type :allocate)))
+    (setq ,var (alien:addr ,var))
+    ,@body)
+  #+lispworks
+  `(fli:with-dynamic-foreign-objects ((,var ,(convert-from-uffi-type type :allocate)))
+    ,@body)
+  )
 
 
 (defmacro with-foreign-objects (bindings &rest body)