summaryrefslogtreecommitdiff
path: root/src/platform.lisp
blob: 1b976f41a11998c0436352e385e6e680f3c2b91b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
(in-package #:ocl)

(defun get-platform-ids ()
  (let ((num-platforms nil))
    (cffi:with-foreign-object (c-num-platforms 'cl-uint)
      (check-error (%get-platform-ids 0 (cffi:null-pointer) c-num-platforms))
      (setf num-platforms (cffi:mem-ref c-num-platforms 'cl-uint)))
    (cffi:with-foreign-object (c-platforms 'cl-platform-id num-platforms)
      (check-error (%get-platform-ids num-platforms c-platforms (cffi:null-pointer)))
      (loop :for i :below num-platforms
            :collect (cffi:mem-aref c-platforms 'cl-platform-id i)))))

(defparameter +platform-info-type-alist+
  '((:platform-profile                 . :string)
    (:platform-version                 . :string)
    (:platform-numeric-version         . cl-version)
    (:platform-name                    . :string)
    (:platform-vendor                  . :string)
    (:platform-extensions              . :string)
    (:platform-extensions-with-version . (:pointer cl-name-version))
    (:platform-host-timer-resolution   . cl-ulong)))

(wrap-get-info-function get-platform-info %get-platform-info
                        +platform-info-type-alist+)