hs-bindgen-1.0.0.0: test-artefacts/fixtures/macros/reparse/nesting/union_in_struct/th.txt
-- addDependentFile test-artefacts/headers/golden/macros/reparse/nesting/union_in_struct.h
-- #include <macros/reparse/nesting/union_in_struct.h>
-- /* test_macrosreparsenestingunion_i_Example_get_T1 */
-- __attribute__ ((const))
-- void *hs_bindgen_44a1ef54c1044601 (void)
-- {
-- return &T1;
-- }
-- /* test_macrosreparsenestingunion_i_Example_get_T2 */
-- __attribute__ ((const))
-- void *hs_bindgen_915293812630a04d (void)
-- {
-- return &T2;
-- }
-- /* test_macrosreparsenestingunion_i_Example_get_T3 */
-- __attribute__ ((const))
-- void *hs_bindgen_e20a6c1bc9b97a9e (void)
-- {
-- return &T3;
-- }
{-| __C declaration:__ @macro MyInt@
__defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 1:9@
__exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
-}
newtype MyInt
= MyInt {unwrapMyInt :: CInt}
deriving stock (Eq, Generic, Ord, Read, Show)
deriving newtype (Bitfield,
Bits,
Bounded,
Enum,
FiniteBits,
HasFFIType,
Integral,
Ix,
Num,
Prim,
ReadRaw,
Real,
StaticSize,
Storable,
WriteRaw)
instance (~) ty CInt => HasField "unwrapMyInt" MyInt ty
where hasField = \x_0 -> (\y_1 -> MyInt{unwrapMyInt = y_1},
getField @"unwrapMyInt" x_0)
instance (~) ty CInt => HasField "unwrapMyInt" (Ptr MyInt) (Ptr ty)
where getField = fromPtr (Proxy @"unwrapMyInt")
instance HasCField MyInt "unwrapMyInt"
where type CFieldType MyInt "unwrapMyInt" = CInt
offset# = \_ -> \_ -> 0
{-| __C declaration:__ @union \@T1_x@
__defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 3:10@
__exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
-}
newtype T1_x
= T1_x {unwrapT1_x :: ByteArray}
deriving stock Generic
deriving via (SizedByteArray 4 4) instance StaticSize T1_x
deriving via (SizedByteArray 4 4) instance ReadRaw T1_x
deriving via (SizedByteArray 4 4) instance WriteRaw T1_x
deriving via (EquivStorable T1_x) instance Storable T1_x
deriving via (SizedByteArray 4 4) instance IsUnion T1_x
instance (~) ty MyInt => HasField "t1_x_x" T1_x ty
where getField = getUnionPayload
instance (~) ty MyInt => HasField "t1_x_x" T1_x ty
where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
getField @"t1_x_x" x_0)
instance (~) ty MyInt => HasField "t1_x_x" (Ptr T1_x) (Ptr ty)
where getField = fromPtr (Proxy @"t1_x_x")
instance HasCField T1_x "t1_x_x"
where type CFieldType T1_x "t1_x_x" = MyInt
offset# = \_ -> \_ -> 0
{-| __C declaration:__ @struct \@T1@
__defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 3:1@
__exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
-}
data T1
= T1 {t1_x :: T1_x
{- ^ __C declaration:__ @x@
__defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 3:32@
__exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
-}}
deriving stock Generic
instance StaticSize T1
where staticSizeOf = \_ -> 4 :: Int
staticAlignment = \_ -> 4 :: Int
instance ReadRaw T1
where readRaw = \ptr_0 -> pure T1 <*> readRaw (Proxy @"t1_x") ptr_0
instance WriteRaw T1
where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
T1 t1_x_2 -> writeRaw (Proxy @"t1_x") ptr_0 t1_x_2
deriving via (EquivStorable T1) instance Storable T1
deriving via (IsStructViaReadRaw T1) instance IsStruct T1
instance (~) ty T1_x => HasField "t1_x" T1 ty
where hasField = \x_0 -> (\y_1 -> T1{t1_x = y_1},
getField @"t1_x" x_0)
instance (~) ty T1_x => HasField "t1_x" (Ptr T1) (Ptr ty)
where getField = fromPtr (Proxy @"t1_x")
instance HasCField T1 "t1_x"
where type CFieldType T1 "t1_x" = T1_x
offset# = \_ -> \_ -> 0
{-| __C declaration:__ @struct \@T2@
__defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 4:1@
__exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
-}
data T2
= T2 {t2_x :: (Ptr T2_x)
{- ^ __C declaration:__ @x@
__defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 4:32@
__exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
-}}
deriving stock (Eq, Generic, Show)
instance StaticSize T2
where staticSizeOf = \_ -> 8 :: Int
staticAlignment = \_ -> 8 :: Int
instance ReadRaw T2
where readRaw = \ptr_0 -> pure T2 <*> readRaw (Proxy @"t2_x") ptr_0
instance WriteRaw T2
where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
T2 t2_x_2 -> writeRaw (Proxy @"t2_x") ptr_0 t2_x_2
deriving via (EquivStorable T2) instance Storable T2
deriving via (IsStructViaReadRaw T2) instance IsStruct T2
instance (~) ty (Ptr T2_x) => HasField "t2_x" T2 ty
where hasField = \x_0 -> (\y_1 -> T2{t2_x = y_1},
getField @"t2_x" x_0)
instance (~) ty (Ptr T2_x) => HasField "t2_x" (Ptr T2) (Ptr ty)
where getField = fromPtr (Proxy @"t2_x")
instance HasCField T2 "t2_x"
where type CFieldType T2 "t2_x" = Ptr T2_x
offset# = \_ -> \_ -> 0
{-| __C declaration:__ @union \@T2_x@
__defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 4:10@
__exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
-}
newtype T2_x
= T2_x {unwrapT2_x :: ByteArray}
deriving stock Generic
deriving via (SizedByteArray 4 4) instance StaticSize T2_x
deriving via (SizedByteArray 4 4) instance ReadRaw T2_x
deriving via (SizedByteArray 4 4) instance WriteRaw T2_x
deriving via (EquivStorable T2_x) instance Storable T2_x
deriving via (SizedByteArray 4 4) instance IsUnion T2_x
instance (~) ty MyInt => HasField "t2_x_x" T2_x ty
where getField = getUnionPayload
instance (~) ty MyInt => HasField "t2_x_x" T2_x ty
where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
getField @"t2_x_x" x_0)
instance (~) ty MyInt => HasField "t2_x_x" (Ptr T2_x) (Ptr ty)
where getField = fromPtr (Proxy @"t2_x_x")
instance HasCField T2_x "t2_x_x"
where type CFieldType T2_x "t2_x_x" = MyInt
offset# = \_ -> \_ -> 0
{-| __C declaration:__ @struct \@T3@
__defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 5:1@
__exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
-}
data T3
= T3 {t3_x :: (Ptr (Ptr T3_x))
{- ^ __C declaration:__ @x@
__defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 5:32@
__exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
-}}
deriving stock (Eq, Generic, Show)
instance StaticSize T3
where staticSizeOf = \_ -> 8 :: Int
staticAlignment = \_ -> 8 :: Int
instance ReadRaw T3
where readRaw = \ptr_0 -> pure T3 <*> readRaw (Proxy @"t3_x") ptr_0
instance WriteRaw T3
where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
T3 t3_x_2 -> writeRaw (Proxy @"t3_x") ptr_0 t3_x_2
deriving via (EquivStorable T3) instance Storable T3
deriving via (IsStructViaReadRaw T3) instance IsStruct T3
instance (~) ty (Ptr (Ptr T3_x)) => HasField "t3_x" T3 ty
where hasField = \x_0 -> (\y_1 -> T3{t3_x = y_1},
getField @"t3_x" x_0)
instance (~) ty (Ptr (Ptr T3_x)) =>
HasField "t3_x" (Ptr T3) (Ptr ty)
where getField = fromPtr (Proxy @"t3_x")
instance HasCField T3 "t3_x"
where type CFieldType T3 "t3_x" = Ptr (Ptr T3_x)
offset# = \_ -> \_ -> 0
{-| __C declaration:__ @union \@T3_x@
__defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 5:10@
__exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
-}
newtype T3_x
= T3_x {unwrapT3_x :: ByteArray}
deriving stock Generic
deriving via (SizedByteArray 4 4) instance StaticSize T3_x
deriving via (SizedByteArray 4 4) instance ReadRaw T3_x
deriving via (SizedByteArray 4 4) instance WriteRaw T3_x
deriving via (EquivStorable T3_x) instance Storable T3_x
deriving via (SizedByteArray 4 4) instance IsUnion T3_x
instance (~) ty MyInt => HasField "t3_x_x" T3_x ty
where getField = getUnionPayload
instance (~) ty MyInt => HasField "t3_x_x" T3_x ty
where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
getField @"t3_x_x" x_0)
instance (~) ty MyInt => HasField "t3_x_x" (Ptr T3_x) (Ptr ty)
where getField = fromPtr (Proxy @"t3_x_x")
instance HasCField T3_x "t3_x_x"
where type CFieldType T3_x "t3_x_x" = MyInt
offset# = \_ -> \_ -> 0
-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T1@
foreign import ccall unsafe "hs_bindgen_44a1ef54c1044601" hs_bindgen_44a1ef54c1044601_base ::
IO (Ptr Void)
-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T1@
hs_bindgen_44a1ef54c1044601 :: IO (Ptr T1)
-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T1@
hs_bindgen_44a1ef54c1044601 = fmap fromFFIType hs_bindgen_44a1ef54c1044601_base
{-# NOINLINE t1 #-}
{-| __C declaration:__ @T1@
__defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 3:37@
__exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
-}
t1 :: Ptr T1
{-| __C declaration:__ @T1@
__defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 3:37@
__exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
-}
t1 = unsafePerformIO hs_bindgen_44a1ef54c1044601
-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T2@
foreign import ccall unsafe "hs_bindgen_915293812630a04d" hs_bindgen_915293812630a04d_base ::
IO (Ptr Void)
-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T2@
hs_bindgen_915293812630a04d :: IO (Ptr T2)
-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T2@
hs_bindgen_915293812630a04d = fmap fromFFIType hs_bindgen_915293812630a04d_base
{-# NOINLINE t2 #-}
{-| __C declaration:__ @T2@
__defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 4:37@
__exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
-}
t2 :: Ptr T2
{-| __C declaration:__ @T2@
__defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 4:37@
__exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
-}
t2 = unsafePerformIO hs_bindgen_915293812630a04d
-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T3@
foreign import ccall unsafe "hs_bindgen_e20a6c1bc9b97a9e" hs_bindgen_e20a6c1bc9b97a9e_base ::
IO (Ptr Void)
-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T3@
hs_bindgen_e20a6c1bc9b97a9e :: IO (Ptr T3)
-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T3@
hs_bindgen_e20a6c1bc9b97a9e = fmap fromFFIType hs_bindgen_e20a6c1bc9b97a9e_base
{-# NOINLINE t3 #-}
{-| __C declaration:__ @T3@
__defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 5:37@
__exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
-}
t3 :: Ptr T3
{-| __C declaration:__ @T3@
__defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 5:37@
__exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
-}
t3 = unsafePerformIO hs_bindgen_e20a6c1bc9b97a9e