-- addDependentFile examples/golden/types/typedefs/typedef_vs_macro.h
{-| __C declaration:__ @T1@

    __defined at:__ @types\/typedefs\/typedef_vs_macro.h 1:13@

    __exported by:__ @types\/typedefs\/typedef_vs_macro.h@
-}
newtype T1
    = T1 {unwrapT1 :: CInt}
      {- ^ __C declaration:__ @T1@

           __defined at:__ @types\/typedefs\/typedef_vs_macro.h 1:13@

           __exported by:__ @types\/typedefs\/typedef_vs_macro.h@
      -}
    deriving stock (Eq, Ord, Read, Show)
    deriving newtype (StaticSize,
                      ReadRaw,
                      WriteRaw,
                      Storable,
                      HasFFIType,
                      Prim,
                      Bitfield,
                      Bits,
                      Bounded,
                      Enum,
                      FiniteBits,
                      Integral,
                      Ix,
                      Num,
                      Real)
instance TyEq ty (CFieldType T1 "unwrapT1") =>
         HasField "unwrapT1" (Ptr T1) (Ptr ty)
    where getField = fromPtr (Proxy @"unwrapT1")
instance HasCField T1 "unwrapT1"
    where type CFieldType T1 "unwrapT1" = CInt
          offset# = \_ -> \_ -> 0
{-| __C declaration:__ @T2@

    __defined at:__ @types\/typedefs\/typedef_vs_macro.h 2:14@

    __exported by:__ @types\/typedefs\/typedef_vs_macro.h@
-}
newtype T2
    = T2 {unwrapT2 :: CChar}
      {- ^ __C declaration:__ @T2@

           __defined at:__ @types\/typedefs\/typedef_vs_macro.h 2:14@

           __exported by:__ @types\/typedefs\/typedef_vs_macro.h@
      -}
    deriving stock (Eq, Ord, Read, Show)
    deriving newtype (StaticSize,
                      ReadRaw,
                      WriteRaw,
                      Storable,
                      HasFFIType,
                      Prim,
                      Bitfield,
                      Bits,
                      Bounded,
                      Enum,
                      FiniteBits,
                      Integral,
                      Ix,
                      Num,
                      Real)
instance TyEq ty (CFieldType T2 "unwrapT2") =>
         HasField "unwrapT2" (Ptr T2) (Ptr ty)
    where getField = fromPtr (Proxy @"unwrapT2")
instance HasCField T2 "unwrapT2"
    where type CFieldType T2 "unwrapT2" = CChar
          offset# = \_ -> \_ -> 0
{-| __C declaration:__ @M1@

    __defined at:__ @types\/typedefs\/typedef_vs_macro.h 4:9@

    __exported by:__ @types\/typedefs\/typedef_vs_macro.h@
-}
newtype M1
    = M1 {unwrapM1 :: CInt}
      {- ^ __C declaration:__ @M1@

           __defined at:__ @types\/typedefs\/typedef_vs_macro.h 4:9@

           __exported by:__ @types\/typedefs\/typedef_vs_macro.h@
      -}
    deriving stock (Eq, Ord, Read, Show)
    deriving newtype (StaticSize,
                      ReadRaw,
                      WriteRaw,
                      Storable,
                      HasFFIType,
                      Prim,
                      Bitfield,
                      Bits,
                      Bounded,
                      Enum,
                      FiniteBits,
                      Integral,
                      Ix,
                      Num,
                      Real)
instance TyEq ty (CFieldType M1 "unwrapM1") =>
         HasField "unwrapM1" (Ptr M1) (Ptr ty)
    where getField = fromPtr (Proxy @"unwrapM1")
instance HasCField M1 "unwrapM1"
    where type CFieldType M1 "unwrapM1" = CInt
          offset# = \_ -> \_ -> 0
{-| __C declaration:__ @M2@

    __defined at:__ @types\/typedefs\/typedef_vs_macro.h 5:9@

    __exported by:__ @types\/typedefs\/typedef_vs_macro.h@
-}
newtype M2
    = M2 {unwrapM2 :: CChar}
      {- ^ __C declaration:__ @M2@

           __defined at:__ @types\/typedefs\/typedef_vs_macro.h 5:9@

           __exported by:__ @types\/typedefs\/typedef_vs_macro.h@
      -}
    deriving stock (Eq, Ord, Read, Show)
    deriving newtype (StaticSize,
                      ReadRaw,
                      WriteRaw,
                      Storable,
                      HasFFIType,
                      Prim,
                      Bitfield,
                      Bits,
                      Bounded,
                      Enum,
                      FiniteBits,
                      Integral,
                      Ix,
                      Num,
                      Real)
instance TyEq ty (CFieldType M2 "unwrapM2") =>
         HasField "unwrapM2" (Ptr M2) (Ptr ty)
    where getField = fromPtr (Proxy @"unwrapM2")
instance HasCField M2 "unwrapM2"
    where type CFieldType M2 "unwrapM2" = CChar
          offset# = \_ -> \_ -> 0
{-| __C declaration:__ @M3@

    __defined at:__ @types\/typedefs\/typedef_vs_macro.h 6:9@

    __exported by:__ @types\/typedefs\/typedef_vs_macro.h@
-}
newtype M3
    = M3 {unwrapM3 :: (Ptr CInt)}
      {- ^ __C declaration:__ @M3@

           __defined at:__ @types\/typedefs\/typedef_vs_macro.h 6:9@

           __exported by:__ @types\/typedefs\/typedef_vs_macro.h@
      -}
    deriving stock (Eq, Ord, Show)
    deriving newtype (StaticSize,
                      ReadRaw,
                      WriteRaw,
                      Storable,
                      HasFFIType)
instance TyEq ty (CFieldType M3 "unwrapM3") =>
         HasField "unwrapM3" (Ptr M3) (Ptr ty)
    where getField = fromPtr (Proxy @"unwrapM3")
instance HasCField M3 "unwrapM3"
    where type CFieldType M3 "unwrapM3" = Ptr CInt
          offset# = \_ -> \_ -> 0
{-| __C declaration:__ @struct ExampleStruct@

    __defined at:__ @types\/typedefs\/typedef_vs_macro.h 8:8@

    __exported by:__ @types\/typedefs\/typedef_vs_macro.h@
-}
data ExampleStruct
    = ExampleStruct {exampleStruct_t1 :: T1
                     {- ^ __C declaration:__ @t1@

                          __defined at:__ @types\/typedefs\/typedef_vs_macro.h 9:6@

                          __exported by:__ @types\/typedefs\/typedef_vs_macro.h@
                     -},
                     exampleStruct_t2 :: T2
                     {- ^ __C declaration:__ @t2@

                          __defined at:__ @types\/typedefs\/typedef_vs_macro.h 10:6@

                          __exported by:__ @types\/typedefs\/typedef_vs_macro.h@
                     -},
                     exampleStruct_m1 :: M1
                     {- ^ __C declaration:__ @m1@

                          __defined at:__ @types\/typedefs\/typedef_vs_macro.h 11:6@

                          __exported by:__ @types\/typedefs\/typedef_vs_macro.h@
                     -},
                     exampleStruct_m2 :: M2
                     {- ^ __C declaration:__ @m2@

                          __defined at:__ @types\/typedefs\/typedef_vs_macro.h 12:6@

                          __exported by:__ @types\/typedefs\/typedef_vs_macro.h@
                     -}}
      {- ^ __C declaration:__ @struct ExampleStruct@

           __defined at:__ @types\/typedefs\/typedef_vs_macro.h 8:8@

           __exported by:__ @types\/typedefs\/typedef_vs_macro.h@
      -}
    deriving stock (Eq, Show)
instance StaticSize ExampleStruct
    where staticSizeOf = \_ -> 16 :: Int
          staticAlignment = \_ -> 4 :: Int
instance ReadRaw ExampleStruct
    where readRaw = \ptr_0 -> (((pure ExampleStruct <*> readRaw (Proxy @"exampleStruct_t1") ptr_0) <*> readRaw (Proxy @"exampleStruct_t2") ptr_0) <*> readRaw (Proxy @"exampleStruct_m1") ptr_0) <*> readRaw (Proxy @"exampleStruct_m2") ptr_0
instance WriteRaw ExampleStruct
    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
                                       ExampleStruct exampleStruct_t1_2
                                                     exampleStruct_t2_3
                                                     exampleStruct_m1_4
                                                     exampleStruct_m2_5 -> writeRaw (Proxy @"exampleStruct_t1") ptr_0 exampleStruct_t1_2 >> (writeRaw (Proxy @"exampleStruct_t2") ptr_0 exampleStruct_t2_3 >> (writeRaw (Proxy @"exampleStruct_m1") ptr_0 exampleStruct_m1_4 >> writeRaw (Proxy @"exampleStruct_m2") ptr_0 exampleStruct_m2_5))
deriving via (EquivStorable ExampleStruct) instance Storable ExampleStruct
instance HasCField ExampleStruct "exampleStruct_t1"
    where type CFieldType ExampleStruct "exampleStruct_t1" = T1
          offset# = \_ -> \_ -> 0
instance TyEq ty (CFieldType ExampleStruct "exampleStruct_t1") =>
         HasField "exampleStruct_t1" (Ptr ExampleStruct) (Ptr ty)
    where getField = fromPtr (Proxy @"exampleStruct_t1")
instance HasCField ExampleStruct "exampleStruct_t2"
    where type CFieldType ExampleStruct "exampleStruct_t2" = T2
          offset# = \_ -> \_ -> 4
instance TyEq ty (CFieldType ExampleStruct "exampleStruct_t2") =>
         HasField "exampleStruct_t2" (Ptr ExampleStruct) (Ptr ty)
    where getField = fromPtr (Proxy @"exampleStruct_t2")
instance HasCField ExampleStruct "exampleStruct_m1"
    where type CFieldType ExampleStruct "exampleStruct_m1" = M1
          offset# = \_ -> \_ -> 8
instance TyEq ty (CFieldType ExampleStruct "exampleStruct_m1") =>
         HasField "exampleStruct_m1" (Ptr ExampleStruct) (Ptr ty)
    where getField = fromPtr (Proxy @"exampleStruct_m1")
instance HasCField ExampleStruct "exampleStruct_m2"
    where type CFieldType ExampleStruct "exampleStruct_m2" = M2
          offset# = \_ -> \_ -> 12
instance TyEq ty (CFieldType ExampleStruct "exampleStruct_m2") =>
         HasField "exampleStruct_m2" (Ptr ExampleStruct) (Ptr ty)
    where getField = fromPtr (Proxy @"exampleStruct_m2")
{-| __C declaration:__ @uint64_t@

    __defined at:__ @types\/typedefs\/typedef_vs_macro.h 15:9@

    __exported by:__ @types\/typedefs\/typedef_vs_macro.h@
-}
newtype Uint64_t
    = Uint64_t {unwrapUint64_t :: CInt}
      {- ^ __C declaration:__ @uint64_t@

           __defined at:__ @types\/typedefs\/typedef_vs_macro.h 15:9@

           __exported by:__ @types\/typedefs\/typedef_vs_macro.h@
      -}
    deriving stock (Eq, Ord, Read, Show)
    deriving newtype (StaticSize,
                      ReadRaw,
                      WriteRaw,
                      Storable,
                      HasFFIType,
                      Prim,
                      Bitfield,
                      Bits,
                      Bounded,
                      Enum,
                      FiniteBits,
                      Integral,
                      Ix,
                      Num,
                      Real)
instance TyEq ty (CFieldType Uint64_t "unwrapUint64_t") =>
         HasField "unwrapUint64_t" (Ptr Uint64_t) (Ptr ty)
    where getField = fromPtr (Proxy @"unwrapUint64_t")
instance HasCField Uint64_t "unwrapUint64_t"
    where type CFieldType Uint64_t "unwrapUint64_t" = CInt
          offset# = \_ -> \_ -> 0
{-| __C declaration:__ @struct foo@

    __defined at:__ @types\/typedefs\/typedef_vs_macro.h 17:8@

    __exported by:__ @types\/typedefs\/typedef_vs_macro.h@
-}
data Foo
    = Foo {foo_a :: (Ptr Uint64_t)
           {- ^ __C declaration:__ @a@

                __defined at:__ @types\/typedefs\/typedef_vs_macro.h 18:13@

                __exported by:__ @types\/typedefs\/typedef_vs_macro.h@
           -}}
      {- ^ __C declaration:__ @struct foo@

           __defined at:__ @types\/typedefs\/typedef_vs_macro.h 17:8@

           __exported by:__ @types\/typedefs\/typedef_vs_macro.h@
      -}
    deriving stock (Eq, Show)
instance StaticSize Foo
    where staticSizeOf = \_ -> 8 :: Int
          staticAlignment = \_ -> 8 :: Int
instance ReadRaw Foo
    where readRaw = \ptr_0 -> pure Foo <*> readRaw (Proxy @"foo_a") ptr_0
instance WriteRaw Foo
    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
                                       Foo foo_a_2 -> writeRaw (Proxy @"foo_a") ptr_0 foo_a_2
deriving via (EquivStorable Foo) instance Storable Foo
instance HasCField Foo "foo_a"
    where type CFieldType Foo "foo_a" = Ptr Uint64_t
          offset# = \_ -> \_ -> 0
instance TyEq ty (CFieldType Foo "foo_a") =>
         HasField "foo_a" (Ptr Foo) (Ptr ty)
    where getField = fromPtr (Proxy @"foo_a")
