1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-23 20:05:32 +02:00

Support C99 complex types in (system foreign)

* libguile/foreign.h (SCM_FOREIGN_TYPE_COMPLEX_FLOAT,
  SCM_FOREIGN_TYPE_COMPLEX_DOUBLE): New enums.
* module/system/foreign.scm (complex-float, complex-double): Export new types.
  (make-c-struct, parse-c-struct): Support the new types.
* libguile/foreign.c (complex-float, complex-double): Define new types.
  (alignof, sizeof, pack, unpack): Support the new types.
* test-suite/tests/foreign.test: Test.
This commit is contained in:
Daniel Llorens 2021-11-11 15:47:42 +01:00
parent 24116be822
commit 496f69dba2
6 changed files with 110 additions and 2 deletions

View file

@ -416,7 +416,14 @@
(data (list 77 (list 42 4.2 55) 88)))
(equal? (parse-c-struct (make-c-struct layout data)
layout)
data))))
data)))
(when (defined? 'complex-float)
(pass-if "complex types"
(let ((layout (list complex-float int complex-double))
(data '(1+3i 99 3-1i)))
(equal? data (parse-c-struct (make-c-struct layout data)
layout))))))
(with-test-prefix "lib->cyg"