X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=src%2Fobjects.cl;h=b510b35bcd47f9627f0b1d46445c389d9bb85797;hb=379a7c3e7b8249ace498d8733c87a3f575a7c799;hp=7f10ab5ba30124e4a08f5e43edf5b7b4c3abbff8;hpb=3dd32205c2d49f126223f5e9ad083093d0636de7;p=uffi.git diff --git a/src/objects.cl b/src/objects.cl index 7f10ab5..b510b35 100644 --- a/src/objects.cl +++ b/src/objects.cl @@ -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.14 2002/03/22 20:51:08 kevin Exp $ ;;;; ;;;; This file, part of UFFI, is Copyright (c) 2002 by Kevin M. Rosenberg ;;;; @@ -107,13 +107,22 @@ an array of TYPE with size SIZE." obj ) -;; 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) + #-(or cmu lispworks) ; default version + `(let ((,var (allocate-foreign-object ,type))) (unwind-protect (progn ,@body) - (free-foreign-object ,var)))) + (free-foreign-object ,var))) + #+cmu + (let ((obj (gensym))) + `(alien:with-alien ((,obj ,(convert-from-uffi-type type :allocate))) + (let ((,var (alien:addr ,obj))) + ,@body))) + #+lispworks + `(fli:with-dynamic-foreign-objects ((,var ,(convert-from-uffi-type + type :allocate))) + ,@body) + ) (defmacro with-foreign-objects (bindings &rest body)