Hi !
I have:
(defmd color () red green blue alpha foreign-object
:md-name (gensym "CELLO-COLOR-") :red (c-in 0) :green (c-in 0) :blue (c-in 0) :alpha (c-in 0) :foreign-object (c? (progn (when (and (^foreign-object) (not (null-pointer-p (^foreign- object)))) (foreign-free (^foreign-object))) (let ((fo (foreign-alloc :float :count 4))) (when (not (null-pointer-p fo)) (progn (setf (mem-aref fo :float 0) (/ (^red) 255.00000000000f0)) (setf (mem-aref fo :float 1) (/ (^green) 255.0000000000f0)) (setf (mem-aref fo :float 2) (/ (^blue) 255.0000000000f0)) (setf (mem-aref fo :float 3) (/ (^alpha) 255.0000000000f0))))))))
So far so good. Compiling this works ok. Now I do:
CL-USER> (make-instance 'cnx::color :red 255 :green 128 :blue 0 :alpha 0)
A NEW CELLS::C-DEPENDENT struct @ #x10c95502 = <...> 0 Class --------> #<STRUCTURE-CLASS CELLS::C-DEPENDENT> 1 MODEL --------> CELLO-COLOR-12992 2 SLOT-NAME ----> The symbol CNX::FOREIGN-OBJECT 3 VALUE --------> The symbol NIL 4 INPUTP -------> The symbol NIL 5 SYNAPTIC -----> The symbol NIL 6 CALLER-STORE -> (NIL), a proper list with 1 element 7 STATE --------> The symbol :AWAKE 8 VALUE-STATE --> The symbol :UNEVALUATED 9 PULSE --------> fixnum 0 [#x00000000] 10 PULSE-LAST-CHANGED -> fixnum 0 [#x00000000] 11 PULSE-OBSERVED -> fixnum 0 [#x00000000] 12 LAZY ---------> The symbol NIL 13 OPTIMIZE -----> The symbol T 14 DEBUG --------> The symbol NIL 15 MD-INFO ------> The symbol NIL 16 CODE ---------> ((PROGN ...)), a proper list with 1 element 17 RULE ---------> #<Function (:INTERNAL (MOP:CLASS-DEFAULT-INITARGS CNX::COLOR :FOREIGN-OBJECT) 0) @ #x10cb44ca> 18 USEDS --------> The symbol NIL 19 USAGE --------> A simple-bit-vector (16) #*0000000000000000 [Current process: new-repl-thread] [1i] CL-USER(1):
The only way out is a :reset - not good. What I am doing wrong ? (This is on AllegroCL 8.1).
Thanks for any hints.
Frank
-- Frank Goenninger
Cell: +49 175 4321058 E-Mail: frgo@me.com