r1581: *** empty log message ***
[uffi.git] / src / objects.cl
index 316a7eea35449397fa73703afeb71a4134f5b45b..0f28115a0cbd24565ad81b915475212994923d77 100644 (file)
@@ -1,4 +1,4 @@
-;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10 -*-
+;;;; -*- Mode: ANSI-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.5 2002/03/14 21:03:12 kevin Exp $
+;;;; $Id: objects.cl,v 1.6 2002/03/17 17:33:30 kevin Exp $
 ;;;;
 ;;;; This file, part of UFFI, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;;
 
 (defmacro deref-pointer (ptr type)
   "Returns a object pointed"
-  #+(or lispworks cmu) (declare (ignore type))
-  #+cmu  `(alien:deref ,ptr)
-  #+lispworks `(fli:dereference ,ptr)
-  #+allegro `(ff:fslot-value-typed ,type :c ,ptr)
-  )
+  (let ((result (gensym)))
+    `(let ((,result
+           #+cmu  (alien:deref ,ptr)
+           #+lispworks (fli:dereference ,ptr)
+           #+allegro (ff:fslot-value-typed ,type :c ,ptr)
+           ))
+      (if (and
+          (or (eq ,type :char)
+              (eq ,type :unsigned-char))
+          (numberp ,result))
+         (code-char ,result)
+         ,result))))
 
 (defmacro pointer-address (obj)
   #+cmu