Added array utilities
This commit is contained in:
@@ -884,6 +884,26 @@
|
||||
(debug (pffi-struct-get struct-test2 'n))
|
||||
(assert = (pffi-struct-get struct-test2 'n) 14.0)
|
||||
|
||||
; Array utilities
|
||||
|
||||
(print-header "Array utilities")
|
||||
|
||||
(define test-list1 (list 1 2 3))
|
||||
(debug test-list1)
|
||||
(debug (pffi-list->array 'int test-list1))
|
||||
(assert equal? (pffi-array->list 'int (pffi-list->array 'int test-list1) 3) test-list1)
|
||||
|
||||
(define test-array1 (pffi-pointer-allocate (* (pffi-size-of 'int) 3)))
|
||||
(pffi-pointer-set! test-array1 'int (* (pffi-size-of 'int) 0) 4)
|
||||
(pffi-pointer-set! test-array1 'int (* (pffi-size-of 'int) 1) 5)
|
||||
(pffi-pointer-set! test-array1 'int (* (pffi-size-of 'int) 2) 6)
|
||||
(debug test-array1)
|
||||
(debug (pffi-array->list 'int test-array1 3))
|
||||
(define check-list1 (list 4 5 6))
|
||||
(assert equal? (pffi-array->list 'int test-array1 3) check-list1)
|
||||
|
||||
|
||||
|
||||
;; pffi-struct-dereference
|
||||
|
||||
;(print-header "pffi-struct-dereference 1")
|
||||
|
||||
Reference in New Issue
Block a user