anchor.diff:    (unless-success result
       (api-error name result)))
   
  +(defmacro defun-check-result (name (&rest args) &body body)
  +  `(defun ,name (,@args)
  +     (check-result (progn
  +                     ,@body)
  +                   ',name)))
  +
   #| Platform APIs |#
   
   @export
  
positive.code:       (check-errcode-ret program 'cl-create-program-with-source errcode-ret))))
  
  @export
  (defun release-program (program)
    (check-result (cl-release-program program)
                  'release-program))
  
  @export
  (defun build-program (program
                        num-devices
                        device-list
                        &optional
                          (options (null-pointer))
                          (cl-callback (null-pointer))
                          (user-data (null-pointer)))
    (check-result (cl-build-program program
                                    num-devices
                                    device-list
                                    options
                                    cl-callback
                                    user-data)
                  'build-program))
  
  #| Kernel Object APIs |#
  
  
negative.code:       (check-errcode-ret kernel 'cl-create-kernel errcode-ret))))
  
  @export
  (defun-check-result set-kernel-arg (kernel arg-index arg-size arg-value)
    (cl-set-kernel-arg kernel
                       arg-index
                       arg-size
                       arg-value))
  
  #| Flush and Finish APIs |#
  
  @export
  (defun-check-result flush (command-queue)
    (cl-flush command-queue))
  
  @export
  (defun-check-result finish (command-queue)
    (cl-finish command-queue))
  
  #| Enqueued Commands APIs |#
  
  @export
  (defun-check-result enqueue-ndrange-kernel (command-queue
                                              kernel
                                              work-dim
                                              global-work-offset
                                              global-work-size
                                              local-work-size
                                              &optional
                                              (num-events-in-wait-list 0)
                                              (event-wait-list (null-pointer))
                                              (event (null-pointer)))
    (cl-enqueue-ndrange-kernel command-queue
                               kernel
                               work-dim
                               global-work-offset
                               global-work-size
                               local-work-size
                               num-events-in-wait-list
                               event-wait-list
                               event))
  
  @export
  (defun-check-result enqueue-read-buffer (command-queue
                                           buffer
                                           blocking-read
                                           offset
                                           size
                                           ptr
                                           &optional
                                           (num-events-in-wait-list 0)
                                           (event-wait-list (null-pointer))
                                           (event (null-pointer)))
    (cl-enqueue-read-buffer command-queue
                            buffer
                            blocking-read
                            offset
                            size
                            ptr
                            num-events-in-wait-list
                            event-wait-list
                            event))
  
  @export
  (defun-check-result enqueue-write-buffer (command-queue
                                            buffer
                                            blocking-write
                                            offset
                                            size
                                            ptr
                                            &optional
                                            (num-events-in-wait-list 0)
                                            (event-wait-list (null-pointer))
                                            (event (null-pointer)))
    (cl-enqueue-write-buffer command-queue
                             buffer
                             blocking-write
                             offset
                             size
                             ptr
                             num-events-in-wait-list
                             event-wait-list
                             event))
  
  @export
  (defun-check-result enqueue-copy-buffer (command-queue
                                           src-buffer
                                           dst-buffer
                                           src-offset
                                           dst-offset
                                           size
                                           &optional
                                           (num-events-in-wait-list 0)
                                           (event-wait-list (null-pointer))
                                           (event (null-pointer)))
    (cl-enqueue-copy-buffer command-queue
                            src-buffer
                            dst-buffer
                            src-offset
                            dst-offset
                            size
                            num-events-in-wait-list
                            event-wait-list
                            event))
  
  #| parameter setup |#
  
  