summaryrefslogtreecommitdiff
path: root/module/system
diff options
context:
space:
mode:
authorMikael Djurfeldt <mikael@djurfeldt.com>2021-12-01 18:40:19 +0100
committerMikael Djurfeldt <mikael@djurfeldt.com>2021-12-01 18:40:19 +0100
commit6af3362b059bb132231354ccca7f15c781f50f48 (patch)
treeb3b836e34c3147175da76f413152951a30a0f3ba /module/system
parent3badbb71c6d29ea94e500309b8d6b80e61d0c460 (diff)
downloadguile-6af3362b059bb132231354ccca7f15c781f50f48.tar.gz
Support C99 complex types conditionally in (system foreign)
496f69dba2fdf1720b40349932fcdecd444107c3 introduced C99 complex types in libguile/foreign.h and (system foreign). Since these types are provided conditionally in foreign.h based on autoconf tests they need to be used conditionally in (system foreign) based on their presence.
Diffstat (limited to 'module/system')
-rw-r--r--module/system/foreign.scm16
1 files changed, 12 insertions, 4 deletions
diff --git a/module/system/foreign.scm b/module/system/foreign.scm
index 4458dc783..7fdd6dd95 100644
--- a/module/system/foreign.scm
+++ b/module/system/foreign.scm
@@ -108,8 +108,12 @@
(define *writers*
`((,float . ,bytevector-ieee-single-native-set!)
(,double . ,bytevector-ieee-double-native-set!)
- (,complex-float . ,(writer-complex bytevector-ieee-single-native-set! (sizeof float)))
- (,complex-double . ,(writer-complex bytevector-ieee-double-native-set! (sizeof double)))
+ ,@(if (defined? 'complex-float)
+ `((,complex-float
+ . ,(writer-complex bytevector-ieee-single-native-set! (sizeof float)))
+ (,complex-double
+ . ,(writer-complex bytevector-ieee-double-native-set! (sizeof double))))
+ '())
(,int8 . ,bytevector-s8-set!)
(,uint8 . ,bytevector-u8-set!)
(,int16 . ,bytevector-s16-native-set!)
@@ -123,8 +127,12 @@
(define *readers*
`((,float . ,bytevector-ieee-single-native-ref)
(,double . ,bytevector-ieee-double-native-ref)
- (,complex-float . ,(reader-complex bytevector-ieee-single-native-ref (sizeof float)))
- (,complex-double . ,(reader-complex bytevector-ieee-double-native-ref (sizeof double)))
+ ,@(if (defined? 'complex-float)
+ `((,complex-float
+ . ,(reader-complex bytevector-ieee-single-native-ref (sizeof float)))
+ (,complex-double
+ . ,(reader-complex bytevector-ieee-double-native-ref (sizeof double))))
+ '())
(,int8 . ,bytevector-s8-ref)
(,uint8 . ,bytevector-u8-ref)
(,int16 . ,bytevector-s16-native-ref)