summaryrefslogtreecommitdiff
path: root/test-suite
diff options
context:
space:
mode:
authorDaniel Llorens <lloda@sarc.name>2021-11-11 15:47:42 +0100
committerDaniel Llorens <lloda@sarc.name>2021-11-15 11:34:09 +0100
commit496f69dba2fdf1720b40349932fcdecd444107c3 (patch)
treedc850c5afca668788a24350c0464f1eb817ea353 /test-suite
parent24116be822c96741eacd667e4e3507300c596cba (diff)
downloadguile-496f69dba2fdf1720b40349932fcdecd444107c3.tar.gz
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.
Diffstat (limited to 'test-suite')
-rw-r--r--test-suite/tests/foreign.test9
1 files changed, 8 insertions, 1 deletions
diff --git a/test-suite/tests/foreign.test b/test-suite/tests/foreign.test
index fd0e276e2..28d7b5df8 100644
--- a/test-suite/tests/foreign.test
+++ b/test-suite/tests/foreign.test
@@ -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"