wrap.ss
#lang at-exp scheme
(require scribble/srcdoc
         (file "ffi.ss"))
(require/doc scheme/base
             scribble/manual)

; XXX Add auto-release on objects w/ refcounts
; XXX Add synchronization to events
; XXX Turn *-infos into hash table

(define-syntax-rule (opencl-reprovide s ...)
  (provide/doc
   [thing-doc s any/c
              ; XXX
              @{@scheme[s] from the C API.}]
   ...))

(define-syntax-rule (opencl-rename [new old] ...)
  (begin (define new old)
         ...
         (provide/doc
          [thing-doc new any/c
                     @{@scheme[old] from the C API.}]
          ...)))

;;;;;;;;;;

(opencl-reprovide
 valid-bools
 valid-platform-infos
 valid-device-types
 valid-device-infos
 valid-device-fp-config
 valid-device-mem-cache-types
 valid-device-local-mem-types
 valid-device-exec-capabilities
 valid-command-queue-properties
 valid-mem-flags
 valid-channel-orders
 valid-mem-object-types
 valid-addressing-modes
 valid-filter-modes
 system-platforms
 platform-info
 platform-devices
 device-info
 valid-context-infos
 context-info
 valid-command-queue-infos
 command-queue-info
 context-supported-image-formats
 valid-memobj-infos
 memobj-info
 valid-image-infos
 image-info
 valid-sampler-infos
 sampler-info
 valid-program-infos
 program-info
 valid-program-build-infos
 valid-build-statuses
 program-build-info
 program-kernels
 valid-kernel-infos
 kernel-info
 valid-kernel-work-group-infos
 kernel-work-group-info
 valid-event-infos
 valid-command-types
 valid-command-execution-statuses
 event-info
 valid-profiling-infos
 event-profiling-info
 )

(opencl-rename
 [make-image-format make-cl_image_format]
 [devices->context clCreateContext]
 [device-type->context clCreateContextFromType]
 [context-retain! clRetainContext]
 [context-release! clReleaseContext]
 [make-command-queue clCreateCommandQueue]
 [command-queue-retain! clRetainCommandQueue]
 [command-queue-release! clReleaseCommandQueue]
 [set-command-queue-property! clSetCommandQueueProperty]
 [make-buffer clCreateBuffer]
 [enqueue-read-buffer! clEnqueueReadBuffer]
 [enqueue-write-buffer! clEnqueueWriteBuffer]
 [enqueue-copy-buffer! clEnqueueCopyBuffer]
 [memobj-retain! clRetainMemObject]
 [memobj-release! clReleaseMemObject]
 [make-2d-image clCreateImage2D]
 [make-3d-image clCreateImage3D]
 [enqueue-read-image! clEnqueueReadImage]
 [enqueue-write-image! clEnqueueWriteImage]
 [enqueue-copy-image! clEnqueueCopyImage]
 [enqueue-copy-image-to-buffer! clEnqueueCopyImageToBuffer]
 [enqueue-copy-buffer-to-image! clEnqueueCopyBufferToImage]
 [enqueue-map-buffer! clEnqueueMapBuffer]
 [enqueue-map-image! clEnqueueMapImage]
 [enqueue-unmap-buffer! clEnqueueUnmapMemObject]
 [enqueue-unmap-image! clEnqueueUnmapMemObject]
 [make-sampler clCreateSampler]
 [sampler-retain! clRetainSampler]
 [sampler-release! clReleaseSampler]
 [make-program/source clCreateProgramWithSource]
 [make-program/binary clCreateProgramWithBinary]
 [program-retain! clRetainProgram]
 [program-release! clReleaseProgram]
 [program-build! clBuildProgram]
 [unload-compiler-hint! clUnloadCompiler]
 [program-kernel clCreateKernel]
 [kernel-retain! clRetainKernel]
 [kernel-release! clReleaseKernel]
 [set-kernel-arg:_cl_mem! clSetKernelArg:_cl_mem]
 [set-kernel-arg:_cl_uint! clSetKernelArg:_cl_uint]
 [enqueue-nd-range-kernel! clEnqueueNDRangeKernel]
 [enqueue-kernel! clEnqueueTask]
 [events-wait! clWaitForEvents]
 [event-retain! clRetainEvent]
 [event-release! clReleaseEvent]
 [enqueue-marker! clEnqueueMarker]
 [enqueue-events-wait! clEnqueueWaitForEvents]
 [enqueue-barrier! clEnqueueBarrier]
 [command-queue-flush! clFlush]
 [command-queue-finish! clFinish]
 )