Skip to content

Commit c00f542

Browse files
committed
Use HasBaseForeignType in all foreign imports except for "dynamic"/"wrapper"
1 parent 60fe845 commit c00f542

File tree

147 files changed

+22354
-3421
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

147 files changed

+22354
-3421
lines changed

hs-bindgen/fixtures/arrays/array/Example/FunPtr.hs

Lines changed: 217 additions & 27 deletions
Large diffs are not rendered by default.

hs-bindgen/fixtures/arrays/array/Example/Global.hs

Lines changed: 177 additions & 22 deletions
Large diffs are not rendered by default.

hs-bindgen/fixtures/arrays/array/Example/Safe.hs

Lines changed: 217 additions & 27 deletions
Large diffs are not rendered by default.

hs-bindgen/fixtures/arrays/array/Example/Unsafe.hs

Lines changed: 217 additions & 27 deletions
Large diffs are not rendered by default.

hs-bindgen/fixtures/arrays/array/th.txt

Lines changed: 1226 additions & 242 deletions
Large diffs are not rendered by default.

hs-bindgen/fixtures/attributes/asm/Example/FunPtr.hs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ module Example.FunPtr where
88
import qualified Foreign.C as FC
99
import qualified GHC.IO.Unsafe
1010
import qualified GHC.Ptr as Ptr
11+
import qualified HsBindgen.Runtime.HasBaseForeignType
1112
import qualified HsBindgen.Runtime.Prelude
1213
import Prelude (IO)
1314

@@ -24,10 +25,17 @@ $(HsBindgen.Runtime.Prelude.addCSource (HsBindgen.Runtime.Prelude.unlines
2425
, "}"
2526
]))
2627

28+
{-| This is an internal function.
29+
-}
30+
foreign import ccall unsafe "hs_bindgen_474c22f4687e6d7d" hs_bindgen_474c22f4687e6d7d_base ::
31+
HsBindgen.Runtime.HasBaseForeignType.BaseForeignType (IO (Ptr.FunPtr (FC.CInt -> FC.CInt -> IO FC.CInt)))
32+
2733
{-| __unique:__ @test_attributesasm_Example_get_asm_labeled_function_ptr@
2834
-}
29-
foreign import ccall unsafe "hs_bindgen_474c22f4687e6d7d" hs_bindgen_474c22f4687e6d7d ::
35+
hs_bindgen_474c22f4687e6d7d ::
3036
IO (Ptr.FunPtr (FC.CInt -> FC.CInt -> IO FC.CInt))
37+
hs_bindgen_474c22f4687e6d7d =
38+
HsBindgen.Runtime.HasBaseForeignType.fromBaseForeignType hs_bindgen_474c22f4687e6d7d_base
3139

3240
{-# NOINLINE asm_labeled_function_ptr #-}
3341

hs-bindgen/fixtures/attributes/asm/Example/Global.hs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ module Example.Global where
88
import qualified Foreign.C as FC
99
import qualified GHC.IO.Unsafe
1010
import qualified GHC.Ptr as Ptr
11+
import qualified HsBindgen.Runtime.HasBaseForeignType
1112
import qualified HsBindgen.Runtime.Prelude
1213
import Prelude (IO)
1314

@@ -21,10 +22,17 @@ $(HsBindgen.Runtime.Prelude.addCSource (HsBindgen.Runtime.Prelude.unlines
2122
, "}"
2223
]))
2324

25+
{-| This is an internal function.
26+
-}
27+
foreign import ccall unsafe "hs_bindgen_f26ea231d0d58288" hs_bindgen_f26ea231d0d58288_base ::
28+
HsBindgen.Runtime.HasBaseForeignType.BaseForeignType (IO (Ptr.Ptr FC.CInt))
29+
2430
{-| __unique:__ @test_attributesasm_Example_get_asm_labeled_variable_ptr@
2531
-}
26-
foreign import ccall unsafe "hs_bindgen_f26ea231d0d58288" hs_bindgen_f26ea231d0d58288 ::
32+
hs_bindgen_f26ea231d0d58288 ::
2733
IO (Ptr.Ptr FC.CInt)
34+
hs_bindgen_f26ea231d0d58288 =
35+
HsBindgen.Runtime.HasBaseForeignType.fromBaseForeignType hs_bindgen_f26ea231d0d58288_base
2836

2937
{-# NOINLINE asm_labeled_variable_ptr #-}
3038

hs-bindgen/fixtures/attributes/asm/Example/Safe.hs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
module Example.Safe where
77

88
import qualified Foreign.C as FC
9+
import qualified HsBindgen.Runtime.HasBaseForeignType
910
import qualified HsBindgen.Runtime.Prelude
1011
import Prelude (IO)
1112

@@ -20,6 +21,11 @@ $(HsBindgen.Runtime.Prelude.addCSource (HsBindgen.Runtime.Prelude.unlines
2021
, "}"
2122
]))
2223

24+
{-| This is an internal function.
25+
-}
26+
foreign import ccall safe "hs_bindgen_369133049bfc1e73" asm_labeled_function_base ::
27+
HsBindgen.Runtime.HasBaseForeignType.BaseForeignType (FC.CInt -> FC.CInt -> IO FC.CInt)
28+
2329
{-| __C declaration:__ @asm_labeled_function@
2430
2531
__defined at:__ @attributes\/asm.h:4:5@
@@ -28,11 +34,13 @@ $(HsBindgen.Runtime.Prelude.addCSource (HsBindgen.Runtime.Prelude.unlines
2834
2935
__unique:__ @test_attributesasm_Example_Safe_asm_labeled_function@
3036
-}
31-
foreign import ccall safe "hs_bindgen_369133049bfc1e73" asm_labeled_function ::
37+
asm_labeled_function ::
3238
FC.CInt
3339
{- ^ __C declaration:__ @x@
3440
-}
3541
-> FC.CInt
3642
{- ^ __C declaration:__ @y@
3743
-}
3844
-> IO FC.CInt
45+
asm_labeled_function =
46+
HsBindgen.Runtime.HasBaseForeignType.fromBaseForeignType asm_labeled_function_base

hs-bindgen/fixtures/attributes/asm/Example/Unsafe.hs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
module Example.Unsafe where
77

88
import qualified Foreign.C as FC
9+
import qualified HsBindgen.Runtime.HasBaseForeignType
910
import qualified HsBindgen.Runtime.Prelude
1011
import Prelude (IO)
1112

@@ -20,6 +21,11 @@ $(HsBindgen.Runtime.Prelude.addCSource (HsBindgen.Runtime.Prelude.unlines
2021
, "}"
2122
]))
2223

24+
{-| This is an internal function.
25+
-}
26+
foreign import ccall unsafe "hs_bindgen_3ad6c287a2386382" asm_labeled_function_base ::
27+
HsBindgen.Runtime.HasBaseForeignType.BaseForeignType (FC.CInt -> FC.CInt -> IO FC.CInt)
28+
2329
{-| __C declaration:__ @asm_labeled_function@
2430
2531
__defined at:__ @attributes\/asm.h:4:5@
@@ -28,11 +34,13 @@ $(HsBindgen.Runtime.Prelude.addCSource (HsBindgen.Runtime.Prelude.unlines
2834
2935
__unique:__ @test_attributesasm_Example_Unsafe_asm_labeled_function@
3036
-}
31-
foreign import ccall unsafe "hs_bindgen_3ad6c287a2386382" asm_labeled_function ::
37+
asm_labeled_function ::
3238
FC.CInt
3339
{- ^ __C declaration:__ @x@
3440
-}
3541
-> FC.CInt
3642
{- ^ __C declaration:__ @y@
3743
-}
3844
-> IO FC.CInt
45+
asm_labeled_function =
46+
HsBindgen.Runtime.HasBaseForeignType.fromBaseForeignType asm_labeled_function_base

hs-bindgen/fixtures/attributes/asm/th.txt

Lines changed: 47 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,34 @@
2929
-- {
3030
-- return &asm_labeled_variable;
3131
-- }
32+
{-| This is an internal function.
33+
-}
34+
foreign import ccall safe "hs_bindgen_369133049bfc1e73" asm_labeled_function_base :: BaseForeignType (CInt ->
35+
CInt ->
36+
IO CInt)
37+
{-| __C declaration:__ @asm_labeled_function@
38+
39+
__defined at:__ @attributes\/asm.h:4:5@
40+
41+
__exported by:__ @attributes\/asm.h@
42+
43+
__unique:__ @test_attributesasm_Example_Unsafe_asm_labeled_function@
44+
-}
45+
asm_labeled_function :: CInt -> CInt -> IO CInt
46+
{-| __C declaration:__ @asm_labeled_function@
47+
48+
__defined at:__ @attributes\/asm.h:4:5@
49+
50+
__exported by:__ @attributes\/asm.h@
51+
52+
__unique:__ @test_attributesasm_Example_Unsafe_asm_labeled_function@
53+
-}
54+
asm_labeled_function = fromBaseForeignType asm_labeled_function_base
55+
{-| This is an internal function.
56+
-}
57+
foreign import ccall safe "hs_bindgen_3ad6c287a2386382" asm_labeled_function_base :: BaseForeignType (CInt ->
58+
CInt ->
59+
IO CInt)
3260
{-| __C declaration:__ @asm_labeled_function@
3361

3462
__defined at:__ @attributes\/asm.h:4:5@
@@ -37,8 +65,7 @@
3765

3866
__unique:__ @test_attributesasm_Example_Unsafe_asm_labeled_function@
3967
-}
40-
foreign import ccall safe "hs_bindgen_369133049bfc1e73" asm_labeled_function :: CInt ->
41-
CInt -> IO CInt
68+
asm_labeled_function :: CInt -> CInt -> IO CInt
4269
{-| __C declaration:__ @asm_labeled_function@
4370

4471
__defined at:__ @attributes\/asm.h:4:5@
@@ -47,13 +74,19 @@ foreign import ccall safe "hs_bindgen_369133049bfc1e73" asm_labeled_function ::
4774

4875
__unique:__ @test_attributesasm_Example_Unsafe_asm_labeled_function@
4976
-}
50-
foreign import ccall safe "hs_bindgen_3ad6c287a2386382" asm_labeled_function :: CInt ->
51-
CInt -> IO CInt
77+
asm_labeled_function = fromBaseForeignType asm_labeled_function_base
78+
{-| This is an internal function.
79+
-}
80+
foreign import ccall safe "hs_bindgen_474c22f4687e6d7d" hs_bindgen_474c22f4687e6d7d_base :: BaseForeignType (IO (FunPtr (CInt ->
81+
CInt ->
82+
IO CInt)))
83+
{-| __unique:__ @test_attributesasm_Example_get_asm_labeled_function_ptr@
84+
-}
85+
hs_bindgen_474c22f4687e6d7d :: IO (FunPtr (CInt ->
86+
CInt -> IO CInt))
5287
{-| __unique:__ @test_attributesasm_Example_get_asm_labeled_function_ptr@
5388
-}
54-
foreign import ccall safe "hs_bindgen_474c22f4687e6d7d" hs_bindgen_474c22f4687e6d7d :: IO (FunPtr (CInt ->
55-
CInt ->
56-
IO CInt))
89+
hs_bindgen_474c22f4687e6d7d = fromBaseForeignType hs_bindgen_474c22f4687e6d7d_base
5790
{-# NOINLINE asm_labeled_function_ptr #-}
5891
{-| __C declaration:__ @asm_labeled_function@
5992

@@ -69,9 +102,15 @@ asm_labeled_function_ptr :: FunPtr (CInt -> CInt -> IO CInt)
69102
__exported by:__ @attributes\/asm.h@
70103
-}
71104
asm_labeled_function_ptr = unsafePerformIO hs_bindgen_474c22f4687e6d7d
105+
{-| This is an internal function.
106+
-}
107+
foreign import ccall safe "hs_bindgen_f26ea231d0d58288" hs_bindgen_f26ea231d0d58288_base :: BaseForeignType (IO (Ptr CInt))
108+
{-| __unique:__ @test_attributesasm_Example_get_asm_labeled_variable_ptr@
109+
-}
110+
hs_bindgen_f26ea231d0d58288 :: IO (Ptr CInt)
72111
{-| __unique:__ @test_attributesasm_Example_get_asm_labeled_variable_ptr@
73112
-}
74-
foreign import ccall safe "hs_bindgen_f26ea231d0d58288" hs_bindgen_f26ea231d0d58288 :: IO (Ptr CInt)
113+
hs_bindgen_f26ea231d0d58288 = fromBaseForeignType hs_bindgen_f26ea231d0d58288_base
75114
{-# NOINLINE asm_labeled_variable_ptr #-}
76115
{-| __C declaration:__ @asm_labeled_variable@
77116

0 commit comments

Comments
 (0)