1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-29 19:30:36 +02:00

Support C99 complex types conditionally in (system foreign)

496f69dba2 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.
This commit is contained in:
Mikael Djurfeldt 2021-12-01 18:40:19 +01:00
parent 3badbb71c6
commit 6af3362b05

View file

@ -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)