packages feed

hs-bindgen-1.0.0.0: test-artefacts/fixtures/edge-cases/spec_examples/th.txt

-- addDependentFile test-artefacts/headers/golden/edge-cases/spec_examples.h
-- #include <edge-cases/spec_examples.h>
-- void hs_bindgen_8a72aafc705daf44 (
--   int32_T *arg1,
--   cint16_T *arg2,
--   int64_T arg3,
--   int64_T arg4,
--   cint16_T *arg5
-- )
-- {
--   (resample)(arg1, arg2, arg3, arg4, arg5);
-- }
-- void hs_bindgen_2311fa9c0d0d6d06 (
--   int32_T *arg1,
--   cint16_T *arg2,
--   int64_T arg3,
--   int64_T arg4,
--   cint16_T *arg5
-- )
-- {
--   (resample)(arg1, arg2, arg3, arg4, arg5);
-- }
-- /* test_edgecasesspec_examples_Example_get_resample */
-- __attribute__ ((const))
-- void (*hs_bindgen_2b8fc800dad87ec8 (void)) (
--   int32_T *arg1,
--   cint16_T *arg2,
--   int64_T arg3,
--   int64_T arg4,
--   cint16_T *arg5
-- )
-- {
--   return &resample;
-- }
{-| __C declaration:__ @int16_T@

    __defined at:__ @edge-cases\/spec_examples.h 10:15@

    __exported by:__ @edge-cases\/spec_examples.h@
-}
newtype Int16_T
    = Int16_T {unwrapInt16_T :: CShort}
    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 CShort => HasField "unwrapInt16_T" Int16_T ty
    where hasField = \x_0 -> (\y_1 -> Int16_T{unwrapInt16_T = y_1},
                              getField @"unwrapInt16_T" x_0)
instance (~) ty CShort =>
         HasField "unwrapInt16_T" (Ptr Int16_T) (Ptr ty)
    where getField = fromPtr (Proxy @"unwrapInt16_T")
instance HasCField Int16_T "unwrapInt16_T"
    where type CFieldType Int16_T "unwrapInt16_T" = CShort
          offset# = \_ -> \_ -> 0
{-| __C declaration:__ @int32_T@

    __defined at:__ @edge-cases\/spec_examples.h 11:13@

    __exported by:__ @edge-cases\/spec_examples.h@
-}
newtype Int32_T
    = Int32_T {unwrapInt32_T :: 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 "unwrapInt32_T" Int32_T ty
    where hasField = \x_0 -> (\y_1 -> Int32_T{unwrapInt32_T = y_1},
                              getField @"unwrapInt32_T" x_0)
instance (~) ty CInt =>
         HasField "unwrapInt32_T" (Ptr Int32_T) (Ptr ty)
    where getField = fromPtr (Proxy @"unwrapInt32_T")
instance HasCField Int32_T "unwrapInt32_T"
    where type CFieldType Int32_T "unwrapInt32_T" = CInt
          offset# = \_ -> \_ -> 0
{-| __C declaration:__ @int64_T@

    __defined at:__ @edge-cases\/spec_examples.h 12:19@

    __exported by:__ @edge-cases\/spec_examples.h@
-}
newtype Int64_T
    = Int64_T {unwrapInt64_T :: CLLong}
    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 CLLong => HasField "unwrapInt64_T" Int64_T ty
    where hasField = \x_0 -> (\y_1 -> Int64_T{unwrapInt64_T = y_1},
                              getField @"unwrapInt64_T" x_0)
instance (~) ty CLLong =>
         HasField "unwrapInt64_T" (Ptr Int64_T) (Ptr ty)
    where getField = fromPtr (Proxy @"unwrapInt64_T")
instance HasCField Int64_T "unwrapInt64_T"
    where type CFieldType Int64_T "unwrapInt64_T" = CLLong
          offset# = \_ -> \_ -> 0
{-| __C declaration:__ @struct cint16_T@

    __defined at:__ @edge-cases\/spec_examples.h 14:9@

    __exported by:__ @edge-cases\/spec_examples.h@
-}
data Cint16_T
    = Cint16_T {cint16_T_re :: Int16_T
                {- ^ __C declaration:__ @re@

                     __defined at:__ @edge-cases\/spec_examples.h 15:11@

                     __exported by:__ @edge-cases\/spec_examples.h@
                -},
                cint16_T_im :: Int16_T
                {- ^ __C declaration:__ @im@

                     __defined at:__ @edge-cases\/spec_examples.h 16:11@

                     __exported by:__ @edge-cases\/spec_examples.h@
                -}}
    deriving stock (Eq, Generic, Show)
instance StaticSize Cint16_T
    where staticSizeOf = \_ -> 4 :: Int
          staticAlignment = \_ -> 2 :: Int
instance ReadRaw Cint16_T
    where readRaw = \ptr_0 -> (pure Cint16_T <*> readRaw (Proxy @"cint16_T_re") ptr_0) <*> readRaw (Proxy @"cint16_T_im") ptr_0
instance WriteRaw Cint16_T
    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
                                       Cint16_T cint16_T_re_2
                                                cint16_T_im_3 -> writeRaw (Proxy @"cint16_T_re") ptr_0 cint16_T_re_2 >> writeRaw (Proxy @"cint16_T_im") ptr_0 cint16_T_im_3
deriving via (EquivStorable Cint16_T) instance Storable Cint16_T
deriving via (IsStructViaReadRaw Cint16_T) instance IsStruct Cint16_T
instance (~) ty Int16_T => HasField "cint16_T_re" Cint16_T ty
    where hasField = \x_0 -> (\y_1 -> Cint16_T{cint16_T_re = y_1,
                                               cint16_T_im = getField @"cint16_T_im" x_0},
                              getField @"cint16_T_re" x_0)
instance (~) ty Int16_T =>
         HasField "cint16_T_re" (Ptr Cint16_T) (Ptr ty)
    where getField = fromPtr (Proxy @"cint16_T_re")
instance HasCField Cint16_T "cint16_T_re"
    where type CFieldType Cint16_T "cint16_T_re" = Int16_T
          offset# = \_ -> \_ -> 0
instance (~) ty Int16_T => HasField "cint16_T_im" Cint16_T ty
    where hasField = \x_0 -> (\y_1 -> Cint16_T{cint16_T_im = y_1,
                                               cint16_T_re = getField @"cint16_T_re" x_0},
                              getField @"cint16_T_im" x_0)
instance (~) ty Int16_T =>
         HasField "cint16_T_im" (Ptr Cint16_T) (Ptr ty)
    where getField = fromPtr (Proxy @"cint16_T_im")
instance HasCField Cint16_T "cint16_T_im"
    where type CFieldType Cint16_T "cint16_T_im" = Int16_T
          offset# = \_ -> \_ -> 2
{-| __C declaration:__ @struct B@

    __defined at:__ @edge-cases\/spec_examples.h 19:8@

    __exported by:__ @edge-cases\/spec_examples.h@
-}
data B = B {} deriving stock (Eq, Generic, Show)
instance StaticSize B
    where staticSizeOf = \_ -> 0 :: Int
          staticAlignment = \_ -> 1 :: Int
instance ReadRaw B
    where readRaw = \ptr_0 -> pure B
instance WriteRaw B
    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
                                       B -> pure ()
deriving via (EquivStorable B) instance Storable B
deriving via (IsStructViaReadRaw B) instance IsStruct B
{-| __C declaration:__ @struct A@

    __defined at:__ @edge-cases\/spec_examples.h 23:8@

    __exported by:__ @edge-cases\/spec_examples.h@
-}
data A
    = A {a_x :: CDouble
         {- ^ __C declaration:__ @x@

              __defined at:__ @edge-cases\/spec_examples.h 24:10@

              __exported by:__ @edge-cases\/spec_examples.h@
         -},
         a_label :: (Ptr CChar)
         {- ^ __C declaration:__ @label@

              __defined at:__ @edge-cases\/spec_examples.h 25:9@

              __exported by:__ @edge-cases\/spec_examples.h@
         -},
         a_samples :: (ConstantArray 128 CChar)
         {- ^ __C declaration:__ @samples@

              __defined at:__ @edge-cases\/spec_examples.h 26:8@

              __exported by:__ @edge-cases\/spec_examples.h@
         -},
         a_b :: B
         {- ^ __C declaration:__ @b@

              __defined at:__ @edge-cases\/spec_examples.h 27:12@

              __exported by:__ @edge-cases\/spec_examples.h@
         -},
         a_c :: (Ptr C)
         {- ^ __C declaration:__ @c@

              __defined at:__ @edge-cases\/spec_examples.h 28:13@

              __exported by:__ @edge-cases\/spec_examples.h@
         -}}
    deriving stock (Eq, Generic, Show)
instance StaticSize A
    where staticSizeOf = \_ -> 152 :: Int
          staticAlignment = \_ -> 8 :: Int
instance ReadRaw A
    where readRaw = \ptr_0 -> ((((pure A <*> readRaw (Proxy @"a_x") ptr_0) <*> readRaw (Proxy @"a_label") ptr_0) <*> readRaw (Proxy @"a_samples") ptr_0) <*> readRaw (Proxy @"a_b") ptr_0) <*> readRaw (Proxy @"a_c") ptr_0
instance WriteRaw A
    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
                                       A a_x_2
                                         a_label_3
                                         a_samples_4
                                         a_b_5
                                         a_c_6 -> writeRaw (Proxy @"a_x") ptr_0 a_x_2 >> (writeRaw (Proxy @"a_label") ptr_0 a_label_3 >> (writeRaw (Proxy @"a_samples") ptr_0 a_samples_4 >> (writeRaw (Proxy @"a_b") ptr_0 a_b_5 >> writeRaw (Proxy @"a_c") ptr_0 a_c_6)))
deriving via (EquivStorable A) instance Storable A
deriving via (IsStructViaReadRaw A) instance IsStruct A
instance (~) ty CDouble => HasField "a_x" A ty
    where hasField = \x_0 -> (\y_1 -> A{a_x = y_1,
                                        a_label = getField @"a_label" x_0,
                                        a_samples = getField @"a_samples" x_0,
                                        a_b = getField @"a_b" x_0,
                                        a_c = getField @"a_c" x_0},
                              getField @"a_x" x_0)
instance (~) ty CDouble => HasField "a_x" (Ptr A) (Ptr ty)
    where getField = fromPtr (Proxy @"a_x")
instance HasCField A "a_x"
    where type CFieldType A "a_x" = CDouble
          offset# = \_ -> \_ -> 0
instance (~) ty (Ptr CChar) => HasField "a_label" A ty
    where hasField = \x_0 -> (\y_1 -> A{a_label = y_1,
                                        a_x = getField @"a_x" x_0,
                                        a_samples = getField @"a_samples" x_0,
                                        a_b = getField @"a_b" x_0,
                                        a_c = getField @"a_c" x_0},
                              getField @"a_label" x_0)
instance (~) ty (Ptr CChar) => HasField "a_label" (Ptr A) (Ptr ty)
    where getField = fromPtr (Proxy @"a_label")
instance HasCField A "a_label"
    where type CFieldType A "a_label" = Ptr CChar
          offset# = \_ -> \_ -> 8
instance (~) ty (ConstantArray 128 CChar) =>
         HasField "a_samples" A ty
    where hasField = \x_0 -> (\y_1 -> A{a_samples = y_1,
                                        a_x = getField @"a_x" x_0,
                                        a_label = getField @"a_label" x_0,
                                        a_b = getField @"a_b" x_0,
                                        a_c = getField @"a_c" x_0},
                              getField @"a_samples" x_0)
instance (~) ty (ConstantArray 128 CChar) =>
         HasField "a_samples" (Ptr A) (Ptr ty)
    where getField = fromPtr (Proxy @"a_samples")
instance HasCField A "a_samples"
    where type CFieldType A "a_samples" = ConstantArray 128 CChar
          offset# = \_ -> \_ -> 16
instance (~) ty B => HasField "a_b" A ty
    where hasField = \x_0 -> (\y_1 -> A{a_b = y_1,
                                        a_x = getField @"a_x" x_0,
                                        a_label = getField @"a_label" x_0,
                                        a_samples = getField @"a_samples" x_0,
                                        a_c = getField @"a_c" x_0},
                              getField @"a_b" x_0)
instance (~) ty B => HasField "a_b" (Ptr A) (Ptr ty)
    where getField = fromPtr (Proxy @"a_b")
instance HasCField A "a_b"
    where type CFieldType A "a_b" = B
          offset# = \_ -> \_ -> 144
instance (~) ty (Ptr C) => HasField "a_c" A ty
    where hasField = \x_0 -> (\y_1 -> A{a_c = y_1,
                                        a_x = getField @"a_x" x_0,
                                        a_label = getField @"a_label" x_0,
                                        a_samples = getField @"a_samples" x_0,
                                        a_b = getField @"a_b" x_0},
                              getField @"a_c" x_0)
instance (~) ty (Ptr C) => HasField "a_c" (Ptr A) (Ptr ty)
    where getField = fromPtr (Proxy @"a_c")
instance HasCField A "a_c"
    where type CFieldType A "a_c" = Ptr C
          offset# = \_ -> \_ -> 144
{-| __C declaration:__ @struct C@

    __defined at:__ @edge-cases\/spec_examples.h 28:10@

    __exported by:__ @edge-cases\/spec_examples.h@
-}
data C
-- __unique:__ @test_edgecasesspec_examples_Example_Safe_resample@
foreign import ccall safe "hs_bindgen_8a72aafc705daf44" hs_bindgen_8a72aafc705daf44_base ::
    Ptr Void
 -> Ptr Void
 -> CLLong
 -> CLLong
 -> Ptr Void
 -> IO ()
-- __unique:__ @test_edgecasesspec_examples_Example_Safe_resample@
hs_bindgen_8a72aafc705daf44 :: Ptr Int32_T ->
                               Ptr (Elem (ConstantArray 30720000 Cint16_T)) ->
                               Int64_T ->
                               Int64_T -> Ptr (Elem (ConstantArray 30720000 Cint16_T)) -> IO ()
-- __unique:__ @test_edgecasesspec_examples_Example_Safe_resample@
hs_bindgen_8a72aafc705daf44 = \x_0 -> \x_1 -> \x_2 -> \x_3 -> \x_4 -> hs_bindgen_8a72aafc705daf44_base (toFFIType x_0) (toFFIType x_1) (toFFIType x_2) (toFFIType x_3) (toFFIType x_4)
{-| __C declaration:__ @resample@

    __defined at:__ @edge-cases\/spec_examples.h 31:6@

    __exported by:__ @edge-cases\/spec_examples.h@
-}
resample_safe :: Ptr Int32_T ->
                 Ptr (Elem (ConstantArray 30720000 Cint16_T)) ->
                 Int64_T ->
                 Int64_T -> Ptr (Elem (ConstantArray 30720000 Cint16_T)) -> IO ()
{-| __C declaration:__ @resample@

    __defined at:__ @edge-cases\/spec_examples.h 31:6@

    __exported by:__ @edge-cases\/spec_examples.h@
-}
resample_safe = hs_bindgen_8a72aafc705daf44
-- __unique:__ @test_edgecasesspec_examples_Example_Unsafe_resample@
foreign import ccall unsafe "hs_bindgen_2311fa9c0d0d6d06" hs_bindgen_2311fa9c0d0d6d06_base ::
    Ptr Void
 -> Ptr Void
 -> CLLong
 -> CLLong
 -> Ptr Void
 -> IO ()
-- __unique:__ @test_edgecasesspec_examples_Example_Unsafe_resample@
hs_bindgen_2311fa9c0d0d6d06 :: Ptr Int32_T ->
                               Ptr (Elem (ConstantArray 30720000 Cint16_T)) ->
                               Int64_T ->
                               Int64_T -> Ptr (Elem (ConstantArray 30720000 Cint16_T)) -> IO ()
-- __unique:__ @test_edgecasesspec_examples_Example_Unsafe_resample@
hs_bindgen_2311fa9c0d0d6d06 = \x_0 -> \x_1 -> \x_2 -> \x_3 -> \x_4 -> hs_bindgen_2311fa9c0d0d6d06_base (toFFIType x_0) (toFFIType x_1) (toFFIType x_2) (toFFIType x_3) (toFFIType x_4)
{-| __C declaration:__ @resample@

    __defined at:__ @edge-cases\/spec_examples.h 31:6@

    __exported by:__ @edge-cases\/spec_examples.h@
-}
resample_unsafe :: Ptr Int32_T ->
                   Ptr (Elem (ConstantArray 30720000 Cint16_T)) ->
                   Int64_T ->
                   Int64_T -> Ptr (Elem (ConstantArray 30720000 Cint16_T)) -> IO ()
{-| __C declaration:__ @resample@

    __defined at:__ @edge-cases\/spec_examples.h 31:6@

    __exported by:__ @edge-cases\/spec_examples.h@
-}
resample_unsafe = hs_bindgen_2311fa9c0d0d6d06
-- __unique:__ @test_edgecasesspec_examples_Example_get_resample@
foreign import ccall unsafe "hs_bindgen_2b8fc800dad87ec8" hs_bindgen_2b8fc800dad87ec8_base ::
    IO (FunPtr Void)
-- __unique:__ @test_edgecasesspec_examples_Example_get_resample@
hs_bindgen_2b8fc800dad87ec8 :: IO (FunPtr (Ptr Int32_T ->
                                           Ptr (Elem (ConstantArray 30720000 Cint16_T)) ->
                                           Int64_T ->
                                           Int64_T ->
                                           Ptr (Elem (ConstantArray 30720000 Cint16_T)) -> IO ()))
-- __unique:__ @test_edgecasesspec_examples_Example_get_resample@
hs_bindgen_2b8fc800dad87ec8 = fmap fromFFIType hs_bindgen_2b8fc800dad87ec8_base
{-# NOINLINE resample_funptr #-}
{-| __C declaration:__ @resample@

    __defined at:__ @edge-cases\/spec_examples.h 31:6@

    __exported by:__ @edge-cases\/spec_examples.h@
-}
resample_funptr :: FunPtr (Ptr Int32_T ->
                           Ptr (Elem (ConstantArray 30720000 Cint16_T)) ->
                           Int64_T ->
                           Int64_T -> Ptr (Elem (ConstantArray 30720000 Cint16_T)) -> IO ())
{-| __C declaration:__ @resample@

    __defined at:__ @edge-cases\/spec_examples.h 31:6@

    __exported by:__ @edge-cases\/spec_examples.h@
-}
resample_funptr = unsafePerformIO hs_bindgen_2b8fc800dad87ec8