anchor.diff:        (array-type-p  type)))
   
   (defun cffi-type (type)
  -  (acond
  +  (cond
       ((basic-type-p  type) (basic-cffi-type  type))
       ((vector-type-p type) (vector-cffi-type type))
       ((array-type-p  type) (array-cffi-type  type))
  
positive.code:       (alloc-memory-block-interop type n)
        (alloc-memory-block-cuda    type n)))
  
  (defun memory-block-interop-p (blk)
    (ecase (car blk)
      (:interop t)
      (:cuda    nil)))
  
  (defun free-memory-block-interop (blk)
    (let ((gres-ptr (memory-block-graphic-resource-ptr blk))
          (vbo      (memory-block-vertex-buffer-object blk))
          (cffi-ptr (memory-block-cffi-ptr             blk)))
      ;; unregister a buffer object accessed through CUDA
      (cu-graphics-unregister-resource (cffi:mem-ref gres-ptr 'cu-graphics-resource))
      ;; free a pointer to a graphics resource
      (cffi:foreign-free gres-ptr)
      ;; delete a buffer object
      (gl:delete-buffers (list vbo))
      ;; free a pointer to host memory area
      (cffi:foreign-free cffi-ptr)))
  
  (defun free-memory-block-cuda (blk)
    (let ((device-ptr (memory-block-device-ptr blk))
          (cffi-ptr   (memory-block-cffi-ptr   blk)))
      (cu-mem-free (cffi:mem-ref device-ptr 'cu-device-ptr))
      (cffi:foreign-free cffi-ptr)
      (cffi:foreign-free device-ptr)))
  
  (defun free-memory-block (blk)
    (when blk
      (if (memory-block-interop-p blk)
          (free-memory-block-interop blk)
          (free-memory-block-cuda    blk))))
  
  (defun memory-block-cffi-ptr (blk)
    (cadr blk))
  
  (defun memory-block-device-ptr (blk)
    (if (memory-block-interop-p blk)
        (error "interoperable memory block can not return a device pointer through this interface")
        (caddr blk)))
  
  (defmacro with-memory-block-device-ptr ((device-ptr blk) &body body)
    (with-gensyms (gres-ptr gres size-ptr)
  
negative.code: 
  ;;; Timer
  
  (defstruct timer-object
    start-event stop-event)
  
  (defun create-timer ()
    (let ((timer-object (make-timer-object)))
      (symbol-macrolet ((start-event (timer-object-start-event timer-object))
                        (stop-event  (timer-object-stop-event  timer-object)))
        (unwind-protect-case ()
            (progn
              ;; allocate memory pointers to start and stop events
              (setf start-event (cffi:foreign-alloc 'cu-event :initial-element (cffi:null-pointer))
                    stop-event  (cffi:foreign-alloc 'cu-event :initial-element (cffi:null-pointer)))
              ;; create a start event
              (cu-event-create start-event cu-event-default)
              ;; create a stop event
              (cu-event-create stop-event  cu-event-default)
              ;; return a timer object
              timer-object)
          (:abort (destroy-timer timer-object))))))
  
  (defun destroy-timer (timer-object)
    (symbol-macrolet ((start-event         (timer-object-start-event timer-object))
                      (stop-event          (timer-object-stop-event  timer-object))
                      (mem-ref-start-event (cffi:mem-ref start-event 'cu-event))
                      (mem-ref-stop-event  (cffi:mem-ref stop-event  'cu-event)))
      ;; destroy a stop event if created
      (when (and stop-event (not (cffi:null-pointer-p mem-ref-stop-event)))
        (cu-event-destroy mem-ref-stop-event)
        (setf mem-ref-stop-event (cffi:null-pointer)))
      ;; destroy a start event if created
      (when (and start-event (not (cffi:null-pointer-p mem-ref-start-event)))
        (cu-event-destroy mem-ref-start-event)
        (setf mem-ref-start-event (cffi:null-pointer)))
      ;; free a memory pointer to a stop event if allocated
      (when stop-event
        (cffi:foreign-free stop-event)
        (setf stop-event nil))
      ;; free a memory pointer to a start event if allocated
      (when start-event
        (cffi:foreign-free start-event)
        (setf start-event nil))))
  
  (defmacro with-timer ((timer) &body body)
    `(let ((,timer (create-timer)))
       (unwind-protect (progn ,@body)
         (destroy-timer ,timer))))
  
  (defun start-timer (timer-object)
    (let ((start-event (timer-object-start-event timer-object)))
  