cmucl alien type question 
Author Message
 cmucl alien type question

Hi.  This one is for all the CMUCL gurus.

I have some lisp code(a volume renderer) that accesses an alien data
structure.  Currently, this is what I do:

(def-alien-variable "rawdata" (* unsigned-char))

and to access:

(defun get-vol-value (x y z)
  (declare (fixnum x y z))
    (deref rawdata (+ (the fixnum (* (the fixnum (* z vol-width-fixnum))
                                         vol-height-fixnum))
                      (the fixnum (* y vol-width-fixnum))
                      x)))

As you can see, the alien type is simply a pointer to a chunk of unsigned
characters.  The problem is that I want to access this data as if it were
a 3 dimensional array.  My GET-VOL-VALUE function does this, albeit
slowly.  What I want to do is cast this data structure into a new alien
type so that I can access it via:

(deref rawdata x y z)

This should be more efficient, correct?

I've tried doing:

(alien:cast rawdata (array (* unsigned-char) vol-width vol-height
  vol-depth))

but I'm not sure what this does.  Does this change the old rawdata
type or does it create a new one?  I recieved lots of warnings when I
would try to access the alien.

I would like to avoid moving this data structure into the lisp heap as it
adds about 10 seconds to total gc time when I do this.

I'd appreciate any help anyone could give me.

--Jonathan



Sun, 06 Mar 2005 09:05:02 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. CMUCL, def-alien-routine, c-string type and :in-out behaviour

2. Newbie question about Alien interface in CMUCL

3. ALIEN objects and GC in CMUCL

4. CMUCL ALIEN PROBLEM

5. Question about dynamic types of record types

6. New User Question: extension types and python 2.2/class/type

7. Inheritance of abstract types: accessing the parent type (F2003 standard question)

8. CMUCL: concurrent programming questions

9. Performance/compatibility question: Allegro CL vs CMUCL?

10. more cmucl & sbcl questions

11. NEWBIE cmucl debugger question

12. ilisp and cmucl question

 

 
Powered by phpBB® Forum Software