From 1f41a14e8e72f484cb6409fe14bfe8113112ea6a Mon Sep 17 00:00:00 2001 From: Joris Dral Date: Thu, 25 Sep 2025 18:11:27 +0200 Subject: [PATCH 1/2] Add a golden example for array types defined using typedef-in-typedef So that we can check whether we erase typedefs succesfully in later commits. --- hs-bindgen/examples/golden/array.h | 9 + hs-bindgen/fixtures/array.bindingspec.yaml | 8 + hs-bindgen/fixtures/array.hs | 491 +++++++++++++++++++-- hs-bindgen/fixtures/array.pp.hs | 185 ++++++-- hs-bindgen/fixtures/array.rs | 10 + hs-bindgen/fixtures/array.th.txt | 365 ++++++++++----- hs-bindgen/fixtures/array.tree-diff.txt | 180 ++++++-- 7 files changed, 1029 insertions(+), 219 deletions(-) diff --git a/hs-bindgen/examples/golden/array.h b/hs-bindgen/examples/golden/array.h index e4023bb14..bb7e31158 100644 --- a/hs-bindgen/examples/golden/array.h +++ b/hs-bindgen/examples/golden/array.h @@ -51,6 +51,9 @@ struct Example { int sudoku[3][3]; }; +//! Typedef-in-typedef +typedef triplet sudoku[3]; + /* * Globals */ @@ -107,6 +110,9 @@ int fun_7(int xss[][3]); //! Multi-dimensional array of unknown size, typedef int fun_8(tripletlist xss); +//! Typedef-in-typedef +int isSolved(sudoku xss); + /* * Function results * @@ -139,3 +145,6 @@ int (*fun_15(void))[][3]; //! Multi-dimensional array of unknown size, typedef tripletlist *fun_16(void); + +//! Typedef-in-typedef +sudoku * solve(void); \ No newline at end of file diff --git a/hs-bindgen/fixtures/array.bindingspec.yaml b/hs-bindgen/fixtures/array.bindingspec.yaml index f198bfdda..fa4c40dbb 100644 --- a/hs-bindgen/fixtures/array.bindingspec.yaml +++ b/hs-bindgen/fixtures/array.bindingspec.yaml @@ -25,6 +25,14 @@ types: - Eq - Show - Storable +- headers: array.h + cname: sudoku + module: Example + hsname: Sudoku + instances: + - Eq + - Show + - Storable - headers: array.h cname: triplet module: Example diff --git a/hs-bindgen/fixtures/array.hs b/hs-bindgen/fixtures/array.hs index 3641b7c34..2861d8089 100644 --- a/hs-bindgen/fixtures/array.hs +++ b/hs-bindgen/fixtures/array.hs @@ -24,7 +24,7 @@ nameHsIdent = Identifier "Triplet"}, declOrigin = NameOriginInSource, - declAliases = [], + declAliases = [Name "sudoku"], declHeaderInfo = Just HeaderInfo { headerMainHeaders = NE.fromList @@ -1037,6 +1037,117 @@ "Example", deriveInstanceComment = Nothing}, + DeclNewtype + Newtype { + newtypeName = Name + "@NsTypeConstr" + "Sudoku", + newtypeConstr = Name + "@NsConstr" + "Sudoku", + newtypeField = Field { + fieldName = Name + "@NsVar" + "un_Sudoku", + fieldType = HsConstArray + 3 + (HsTypRef + (Name + "@NsTypeConstr" + "Triplet")), + fieldOrigin = GeneratedField, + fieldComment = Nothing}, + newtypeOrigin = Decl { + declInfo = DeclInfo { + declLoc = "array.h:55:17", + declId = NamePair { + nameC = Name "sudoku", + nameHsIdent = Identifier + "Sudoku"}, + declOrigin = NameOriginInSource, + declAliases = [], + declHeaderInfo = Just + HeaderInfo { + headerMainHeaders = NE.fromList + ["array.h"], + headerInclude = "array.h"}, + declComment = Just + (Comment + [ + Paragraph + [ + TextContent + "Typedef-in-typedef"]])}, + declKind = Typedef + Typedef { + typedefNames = NewtypeNames { + newtypeConstr = Name + "@NsConstr" + "Sudoku", + newtypeField = Name + "@NsVar" + "un_Sudoku"}, + typedefType = TypeConstArray + 3 + (TypeTypedef + (TypedefRegular + NamePair { + nameC = Name "triplet", + nameHsIdent = Identifier + "Triplet"}))}, + declSpec = DeclSpec + CTypeSpec { + cTypeSpecModule = Nothing, + cTypeSpecIdentifier = Nothing, + cTypeSpecInstances = + Map.fromList []}}, + newtypeInstances = Set.fromList + [Eq, Show, Storable], + newtypeComment = Just + Comment { + commentTitle = Just + [ + TextContent + "Typedef-in-typedef"], + commentOrigin = Just "sudoku", + commentLocation = Just + "array.h:55:17", + commentHeaderInfo = Just + HeaderInfo { + headerMainHeaders = NE.fromList + ["array.h"], + headerInclude = "array.h"}, + commentChildren = []}}, + DeclNewtypeInstance + DeriveInstance { + deriveInstanceStrategy = + DeriveNewtype, + deriveInstanceClass = Storable, + deriveInstanceName = Name + "@NsTypeConstr" + "Sudoku", + deriveInstanceComment = + Nothing}, + DeclNewtypeInstance + DeriveInstance { + deriveInstanceStrategy = + DeriveStock, + deriveInstanceClass = Eq, + deriveInstanceName = Name + "@NsTypeConstr" + "Sudoku", + deriveInstanceComment = + Nothing}, + DeclNewtypeInstance + DeriveInstance { + deriveInstanceStrategy = + DeriveStock, + deriveInstanceClass = Show, + deriveInstanceName = Name + "@NsTypeConstr" + "Sudoku", + deriveInstanceComment = + Nothing}, DeclForeignImport ForeignImportDecl { foreignImportName = Name @@ -1112,7 +1223,7 @@ "Array of known size"], commentOrigin = Just "fun_1", commentLocation = Just - "array.h:87:5", + "array.h:90:5", commentHeaderInfo = Just HeaderInfo { headerMainHeaders = NE.fromList @@ -1177,7 +1288,7 @@ "Array of known size, typedef"], commentOrigin = Just "fun_2", commentLocation = Just - "array.h:90:5", + "array.h:93:5", commentHeaderInfo = Just HeaderInfo { headerMainHeaders = NE.fromList @@ -1241,7 +1352,7 @@ "Array of unknown size"], commentOrigin = Just "fun_3", commentLocation = Just - "array.h:93:5", + "array.h:96:5", commentHeaderInfo = Just HeaderInfo { headerMainHeaders = NE.fromList @@ -1306,7 +1417,7 @@ "Array of unknown size, typedef"], commentOrigin = Just "fun_4", commentLocation = Just - "array.h:96:5", + "array.h:99:5", commentHeaderInfo = Just HeaderInfo { headerMainHeaders = NE.fromList @@ -1375,7 +1486,7 @@ "Multi-dimensional array of known size"], commentOrigin = Just "fun_5", commentLocation = Just - "array.h:99:5", + "array.h:102:5", commentHeaderInfo = Just HeaderInfo { headerMainHeaders = NE.fromList @@ -1442,7 +1553,7 @@ "Multi-dimensional array of known size, typedef"], commentOrigin = Just "fun_6", commentLocation = Just - "array.h:102:5", + "array.h:105:5", commentHeaderInfo = Just HeaderInfo { headerMainHeaders = NE.fromList @@ -1510,7 +1621,7 @@ "Multi-dimensional array of unknown size"], commentOrigin = Just "fun_7", commentLocation = Just - "array.h:105:5", + "array.h:108:5", commentHeaderInfo = Just HeaderInfo { headerMainHeaders = NE.fromList @@ -1577,7 +1688,75 @@ "Multi-dimensional array of unknown size, typedef"], commentOrigin = Just "fun_8", commentLocation = Just - "array.h:108:5", + "array.h:111:5", + commentHeaderInfo = Just + HeaderInfo { + headerMainHeaders = NE.fromList + ["array.h"], + headerInclude = "array.h"}, + commentChildren = []}, + foreignImportSafety = Safe}, + DeclSimple, + DeclForeignImport + ForeignImportDecl { + foreignImportName = Name + "@NsVar" + "isSolved_wrapper", + foreignImportParameters = [ + FunctionParameter { + functionParameterName = Just + (Name "@NsVar" "xss"), + functionParameterType = HsPtr + (HsTypRef + (Name + "@NsTypeConstr" + "Triplet")), + functionParameterComment = Just + Comment { + commentTitle = Nothing, + commentOrigin = Just "xss", + commentLocation = Nothing, + commentHeaderInfo = Nothing, + commentChildren = []}}], + foreignImportResultType = + NormalResultType + (HsIO (HsPrimType HsPrimCInt)), + foreignImportOrigName = + "hs_bindgen_test_array_2280ecc4c152a73f", + foreignImportCallConv = + CallConvUserlandCAPI + UserlandCapiWrapper { + capiWrapperDefinition = + "signed int hs_bindgen_test_array_2280ecc4c152a73f (triplet *arg1) { return isSolved(arg1); }", + capiWrapperImport = "array.h"}, + foreignImportOrigin = Function + Function { + functionArgs = [ + _×_ + (Just + NamePair { + nameC = Name "xss", + nameHsIdent = Identifier "xss"}) + (TypeTypedef + (TypedefRegular + NamePair { + nameC = Name "sudoku", + nameHsIdent = Identifier + "Sudoku"}))], + functionAttrs = + FunctionAttributes + ImpureFunction, + functionRes = TypePrim + (PrimIntegral PrimInt Signed)}, + foreignImportComment = Just + Comment { + commentTitle = Just + [ + TextContent + "Typedef-in-typedef"], + commentOrigin = Just "isSolved", + commentLocation = Just + "array.h:114:5", commentHeaderInfo = Just HeaderInfo { headerMainHeaders = NE.fromList @@ -1628,7 +1807,7 @@ "Array of known size"], commentOrigin = Just "fun_9", commentLocation = Just - "array.h:120:7", + "array.h:126:7", commentHeaderInfo = Just HeaderInfo { headerMainHeaders = NE.fromList @@ -1679,7 +1858,7 @@ "Array of known size, typedef"], commentOrigin = Just "fun_10", commentLocation = Just - "array.h:123:10", + "array.h:129:10", commentHeaderInfo = Just HeaderInfo { headerMainHeaders = NE.fromList @@ -1727,7 +1906,7 @@ "Array of unknown size"], commentOrigin = Just "fun_11", commentLocation = Just - "array.h:126:7", + "array.h:132:7", commentHeaderInfo = Just HeaderInfo { headerMainHeaders = NE.fromList @@ -1778,7 +1957,7 @@ "Array of unknown size, typedef"], commentOrigin = Just "fun_12", commentLocation = Just - "array.h:129:7", + "array.h:135:7", commentHeaderInfo = Just HeaderInfo { headerMainHeaders = NE.fromList @@ -1832,7 +2011,7 @@ "Multi-dimensional array of known size"], commentOrigin = Just "fun_13", commentLocation = Just - "array.h:132:7", + "array.h:138:7", commentHeaderInfo = Just HeaderInfo { headerMainHeaders = NE.fromList @@ -1883,7 +2062,7 @@ "Multi-dimensional array of known size, typedef"], commentOrigin = Just "fun_14", commentLocation = Just - "array.h:135:9", + "array.h:141:9", commentHeaderInfo = Just HeaderInfo { headerMainHeaders = NE.fromList @@ -1935,7 +2114,7 @@ "Multi-dimensional array of unknown size"], commentOrigin = Just "fun_15", commentLocation = Just - "array.h:138:7", + "array.h:144:7", commentHeaderInfo = Just HeaderInfo { headerMainHeaders = NE.fromList @@ -1986,7 +2165,58 @@ "Multi-dimensional array of unknown size, typedef"], commentOrigin = Just "fun_16", commentLocation = Just - "array.h:141:14", + "array.h:147:14", + commentHeaderInfo = Just + HeaderInfo { + headerMainHeaders = NE.fromList + ["array.h"], + headerInclude = "array.h"}, + commentChildren = []}, + foreignImportSafety = Safe}, + DeclForeignImport + ForeignImportDecl { + foreignImportName = Name + "@NsVar" + "solve", + foreignImportParameters = [], + foreignImportResultType = + NormalResultType + (HsIO + (HsPtr + (HsTypRef + (Name + "@NsTypeConstr" + "Sudoku")))), + foreignImportOrigName = + "hs_bindgen_test_array_f6b66497ee1685b0", + foreignImportCallConv = + CallConvUserlandCAPI + UserlandCapiWrapper { + capiWrapperDefinition = + "sudoku *hs_bindgen_test_array_f6b66497ee1685b0 (void) { return solve(); }", + capiWrapperImport = "array.h"}, + foreignImportOrigin = Function + Function { + functionArgs = [], + functionAttrs = + FunctionAttributes + ImpureFunction, + functionRes = TypePointer + (TypeTypedef + (TypedefRegular + NamePair { + nameC = Name "sudoku", + nameHsIdent = Identifier + "Sudoku"}))}, + foreignImportComment = Just + Comment { + commentTitle = Just + [ + TextContent + "Typedef-in-typedef"], + commentOrigin = Just "solve", + commentLocation = Just + "array.h:150:10", commentHeaderInfo = Just HeaderInfo { headerMainHeaders = NE.fromList @@ -2069,7 +2299,7 @@ "Array of known size"], commentOrigin = Just "fun_1", commentLocation = Just - "array.h:87:5", + "array.h:90:5", commentHeaderInfo = Just HeaderInfo { headerMainHeaders = NE.fromList @@ -2134,7 +2364,7 @@ "Array of known size, typedef"], commentOrigin = Just "fun_2", commentLocation = Just - "array.h:90:5", + "array.h:93:5", commentHeaderInfo = Just HeaderInfo { headerMainHeaders = NE.fromList @@ -2198,7 +2428,7 @@ "Array of unknown size"], commentOrigin = Just "fun_3", commentLocation = Just - "array.h:93:5", + "array.h:96:5", commentHeaderInfo = Just HeaderInfo { headerMainHeaders = NE.fromList @@ -2263,7 +2493,7 @@ "Array of unknown size, typedef"], commentOrigin = Just "fun_4", commentLocation = Just - "array.h:96:5", + "array.h:99:5", commentHeaderInfo = Just HeaderInfo { headerMainHeaders = NE.fromList @@ -2332,7 +2562,7 @@ "Multi-dimensional array of known size"], commentOrigin = Just "fun_5", commentLocation = Just - "array.h:99:5", + "array.h:102:5", commentHeaderInfo = Just HeaderInfo { headerMainHeaders = NE.fromList @@ -2399,7 +2629,7 @@ "Multi-dimensional array of known size, typedef"], commentOrigin = Just "fun_6", commentLocation = Just - "array.h:102:5", + "array.h:105:5", commentHeaderInfo = Just HeaderInfo { headerMainHeaders = NE.fromList @@ -2467,7 +2697,7 @@ "Multi-dimensional array of unknown size"], commentOrigin = Just "fun_7", commentLocation = Just - "array.h:105:5", + "array.h:108:5", commentHeaderInfo = Just HeaderInfo { headerMainHeaders = NE.fromList @@ -2534,7 +2764,75 @@ "Multi-dimensional array of unknown size, typedef"], commentOrigin = Just "fun_8", commentLocation = Just - "array.h:108:5", + "array.h:111:5", + commentHeaderInfo = Just + HeaderInfo { + headerMainHeaders = NE.fromList + ["array.h"], + headerInclude = "array.h"}, + commentChildren = []}, + foreignImportSafety = Unsafe}, + DeclSimple, + DeclForeignImport + ForeignImportDecl { + foreignImportName = Name + "@NsVar" + "isSolved_wrapper", + foreignImportParameters = [ + FunctionParameter { + functionParameterName = Just + (Name "@NsVar" "xss"), + functionParameterType = HsPtr + (HsTypRef + (Name + "@NsTypeConstr" + "Triplet")), + functionParameterComment = Just + Comment { + commentTitle = Nothing, + commentOrigin = Just "xss", + commentLocation = Nothing, + commentHeaderInfo = Nothing, + commentChildren = []}}], + foreignImportResultType = + NormalResultType + (HsIO (HsPrimType HsPrimCInt)), + foreignImportOrigName = + "hs_bindgen_test_array_617bd1cd5514ea45", + foreignImportCallConv = + CallConvUserlandCAPI + UserlandCapiWrapper { + capiWrapperDefinition = + "signed int hs_bindgen_test_array_617bd1cd5514ea45 (triplet *arg1) { return isSolved(arg1); }", + capiWrapperImport = "array.h"}, + foreignImportOrigin = Function + Function { + functionArgs = [ + _×_ + (Just + NamePair { + nameC = Name "xss", + nameHsIdent = Identifier "xss"}) + (TypeTypedef + (TypedefRegular + NamePair { + nameC = Name "sudoku", + nameHsIdent = Identifier + "Sudoku"}))], + functionAttrs = + FunctionAttributes + ImpureFunction, + functionRes = TypePrim + (PrimIntegral PrimInt Signed)}, + foreignImportComment = Just + Comment { + commentTitle = Just + [ + TextContent + "Typedef-in-typedef"], + commentOrigin = Just "isSolved", + commentLocation = Just + "array.h:114:5", commentHeaderInfo = Just HeaderInfo { headerMainHeaders = NE.fromList @@ -2585,7 +2883,7 @@ "Array of known size"], commentOrigin = Just "fun_9", commentLocation = Just - "array.h:120:7", + "array.h:126:7", commentHeaderInfo = Just HeaderInfo { headerMainHeaders = NE.fromList @@ -2636,7 +2934,7 @@ "Array of known size, typedef"], commentOrigin = Just "fun_10", commentLocation = Just - "array.h:123:10", + "array.h:129:10", commentHeaderInfo = Just HeaderInfo { headerMainHeaders = NE.fromList @@ -2684,7 +2982,7 @@ "Array of unknown size"], commentOrigin = Just "fun_11", commentLocation = Just - "array.h:126:7", + "array.h:132:7", commentHeaderInfo = Just HeaderInfo { headerMainHeaders = NE.fromList @@ -2735,7 +3033,7 @@ "Array of unknown size, typedef"], commentOrigin = Just "fun_12", commentLocation = Just - "array.h:129:7", + "array.h:135:7", commentHeaderInfo = Just HeaderInfo { headerMainHeaders = NE.fromList @@ -2789,7 +3087,7 @@ "Multi-dimensional array of known size"], commentOrigin = Just "fun_13", commentLocation = Just - "array.h:132:7", + "array.h:138:7", commentHeaderInfo = Just HeaderInfo { headerMainHeaders = NE.fromList @@ -2840,7 +3138,7 @@ "Multi-dimensional array of known size, typedef"], commentOrigin = Just "fun_14", commentLocation = Just - "array.h:135:9", + "array.h:141:9", commentHeaderInfo = Just HeaderInfo { headerMainHeaders = NE.fromList @@ -2892,7 +3190,7 @@ "Multi-dimensional array of unknown size"], commentOrigin = Just "fun_15", commentLocation = Just - "array.h:138:7", + "array.h:144:7", commentHeaderInfo = Just HeaderInfo { headerMainHeaders = NE.fromList @@ -2943,7 +3241,58 @@ "Multi-dimensional array of unknown size, typedef"], commentOrigin = Just "fun_16", commentLocation = Just - "array.h:141:14", + "array.h:147:14", + commentHeaderInfo = Just + HeaderInfo { + headerMainHeaders = NE.fromList + ["array.h"], + headerInclude = "array.h"}, + commentChildren = []}, + foreignImportSafety = Unsafe}, + DeclForeignImport + ForeignImportDecl { + foreignImportName = Name + "@NsVar" + "solve", + foreignImportParameters = [], + foreignImportResultType = + NormalResultType + (HsIO + (HsPtr + (HsTypRef + (Name + "@NsTypeConstr" + "Sudoku")))), + foreignImportOrigName = + "hs_bindgen_test_array_ede6133d23ed3248", + foreignImportCallConv = + CallConvUserlandCAPI + UserlandCapiWrapper { + capiWrapperDefinition = + "sudoku *hs_bindgen_test_array_ede6133d23ed3248 (void) { return solve(); }", + capiWrapperImport = "array.h"}, + foreignImportOrigin = Function + Function { + functionArgs = [], + functionAttrs = + FunctionAttributes + ImpureFunction, + functionRes = TypePointer + (TypeTypedef + (TypedefRegular + NamePair { + nameC = Name "sudoku", + nameHsIdent = Identifier + "Sudoku"}))}, + foreignImportComment = Just + Comment { + commentTitle = Just + [ + TextContent + "Typedef-in-typedef"], + commentOrigin = Just "solve", + commentLocation = Just + "array.h:150:10", commentHeaderInfo = Just HeaderInfo { headerMainHeaders = NE.fromList @@ -3263,6 +3612,44 @@ foreignImportSafety = Unsafe}, DeclSimple, DeclSimple, + DeclForeignImport + ForeignImportDecl { + foreignImportName = Name + "@NsVar" + "hs_bindgen_test_array_bdf2a6a8a3dd5b04", + foreignImportParameters = [], + foreignImportResultType = + NormalResultType + (HsIO + (HsFunPtr + (HsFun + (HsTypRef + (Name "@NsTypeConstr" "Sudoku")) + (HsIO + (HsPrimType HsPrimCInt))))), + foreignImportOrigName = + "hs_bindgen_test_array_bdf2a6a8a3dd5b04", + foreignImportCallConv = + CallConvUserlandCAPI + UserlandCapiWrapper { + capiWrapperDefinition = + "/* get_isSolved_ptr */ __attribute__ ((const)) signed int (*hs_bindgen_test_array_bdf2a6a8a3dd5b04 (void)) (sudoku arg1) { return &isSolved; } ", + capiWrapperImport = "array.h"}, + foreignImportOrigin = Global + (TypeFun + [ + TypeTypedef + (TypedefRegular + NamePair { + nameC = Name "sudoku", + nameHsIdent = Identifier + "Sudoku"})] + (TypePrim + (PrimIntegral PrimInt Signed))), + foreignImportComment = Nothing, + foreignImportSafety = Unsafe}, + DeclSimple, + DeclSimple, DeclForeignImport ForeignImportDecl { foreignImportName = Name @@ -3567,6 +3954,44 @@ foreignImportSafety = Unsafe}, DeclSimple, DeclSimple, + DeclForeignImport + ForeignImportDecl { + foreignImportName = Name + "@NsVar" + "hs_bindgen_test_array_9a62b5848be64bd4", + foreignImportParameters = [], + foreignImportResultType = + NormalResultType + (HsIO + (HsFunPtr + (HsIO + (HsPtr + (HsTypRef + (Name + "@NsTypeConstr" + "Sudoku")))))), + foreignImportOrigName = + "hs_bindgen_test_array_9a62b5848be64bd4", + foreignImportCallConv = + CallConvUserlandCAPI + UserlandCapiWrapper { + capiWrapperDefinition = + "/* get_solve_ptr */ __attribute__ ((const)) sudoku *(*hs_bindgen_test_array_9a62b5848be64bd4 (void)) (void) { return &solve; } ", + capiWrapperImport = "array.h"}, + foreignImportOrigin = Global + (TypeFun + [] + (TypePointer + (TypeTypedef + (TypedefRegular + NamePair { + nameC = Name "sudoku", + nameHsIdent = Identifier + "Sudoku"})))), + foreignImportComment = Nothing, + foreignImportSafety = Unsafe}, + DeclSimple, + DeclSimple, DeclForeignImport ForeignImportDecl { foreignImportName = Name diff --git a/hs-bindgen/fixtures/array.pp.hs b/hs-bindgen/fixtures/array.pp.hs index eeebe0b80..bbd7b8abc 100644 --- a/hs-bindgen/fixtures/array.pp.hs +++ b/hs-bindgen/fixtures/array.pp.hs @@ -17,7 +17,7 @@ import qualified HsBindgen.Runtime.IncompleteArray import qualified HsBindgen.Runtime.Prelude import Prelude ((<*>), (>>), Eq, IO, Int, Show, pure) -$(HsBindgen.Runtime.Prelude.addCSource "#include \nsigned int hs_bindgen_test_array_5d1be223fd040c3b (signed int arg1, signed int *arg2) { return fun_1(arg1, arg2); }\nsigned int hs_bindgen_test_array_cabe35537b18e986 (signed int *arg1) { return fun_2(arg1); }\nsigned int hs_bindgen_test_array_4cdbf10236e78984 (signed int *arg1) { return fun_3(arg1); }\nsigned int hs_bindgen_test_array_e356c5ddb2608063 (signed int *arg1) { return fun_4(arg1); }\nsigned int hs_bindgen_test_array_f5ccf2c8d2e60be5 (signed int (*arg1)[3]) { return fun_5(arg1); }\nsigned int hs_bindgen_test_array_2b3a983697999524 (signed int (*arg1)[3]) { return fun_6(arg1); }\nsigned int hs_bindgen_test_array_72e9371a1b8b8907 (signed int (*arg1)[3]) { return fun_7(arg1); }\nsigned int hs_bindgen_test_array_62ad87463d9a75de (signed int (*arg1)[3]) { return fun_8(arg1); }\nsigned int (*hs_bindgen_test_array_d4c729a69c884fd4 (void))[3] { return fun_9(); }\ntriplet *hs_bindgen_test_array_bb92dfded907271e (void) { return fun_10(); }\nsigned int (*hs_bindgen_test_array_489aaaa59e992ddf (void))[] { return fun_11(); }\nlist *hs_bindgen_test_array_ee94c35f987d6c50 (void) { return fun_12(); }\nsigned int (*hs_bindgen_test_array_ca2c7b60ce85a964 (void))[4][3] { return fun_13(); }\nmatrix *hs_bindgen_test_array_ab2c533efdae8e41 (void) { return fun_14(); }\nsigned int (*hs_bindgen_test_array_019bdeb5db79cee1 (void))[][3] { return fun_15(); }\ntripletlist *hs_bindgen_test_array_ca0e7c51654fef12 (void) { return fun_16(); }\n/* get_fun_1_ptr */ __attribute__ ((const)) signed int (*hs_bindgen_test_array_3ced2f3b2af806f8 (void)) (signed int arg1, signed int arg2[3]) { return &fun_1; } \n/* get_fun_2_ptr */ __attribute__ ((const)) signed int (*hs_bindgen_test_array_84966994a8d7df93 (void)) (triplet arg1) { return &fun_2; } \n/* get_fun_3_ptr */ __attribute__ ((const)) signed int (*hs_bindgen_test_array_3e6c940dbd7e5492 (void)) (signed int arg1[]) { return &fun_3; } \n/* get_fun_4_ptr */ __attribute__ ((const)) signed int (*hs_bindgen_test_array_d9f87d3e541b15e5 (void)) (list arg1) { return &fun_4; } \n/* get_fun_5_ptr */ __attribute__ ((const)) signed int (*hs_bindgen_test_array_cd41e41992d89300 (void)) (signed int arg1[4][3]) { return &fun_5; } \n/* get_fun_6_ptr */ __attribute__ ((const)) signed int (*hs_bindgen_test_array_db0e2655437ab8bb (void)) (matrix arg1) { return &fun_6; } \n/* get_fun_7_ptr */ __attribute__ ((const)) signed int (*hs_bindgen_test_array_9ec02aa16b020aa0 (void)) (signed int arg1[][3]) { return &fun_7; } \n/* get_fun_8_ptr */ __attribute__ ((const)) signed int (*hs_bindgen_test_array_a41b8d1332b69b95 (void)) (tripletlist arg1) { return &fun_8; } \n/* get_fun_9_ptr */ __attribute__ ((const)) signed int (*(*hs_bindgen_test_array_76f53f330102e743 (void)) (void))[3] { return &fun_9; } \n/* get_fun_10_ptr */ __attribute__ ((const)) triplet *(*hs_bindgen_test_array_abcc94f01de77b25 (void)) (void) { return &fun_10; } \n/* get_fun_11_ptr */ __attribute__ ((const)) signed int (*(*hs_bindgen_test_array_6661b46e4a751a85 (void)) (void))[] { return &fun_11; } \n/* get_fun_12_ptr */ __attribute__ ((const)) list *(*hs_bindgen_test_array_9c80a9e3300aad15 (void)) (void) { return &fun_12; } \n/* get_fun_13_ptr */ __attribute__ ((const)) signed int (*(*hs_bindgen_test_array_bb741b7e8c029e7e (void)) (void))[4][3] { return &fun_13; } \n/* get_fun_14_ptr */ __attribute__ ((const)) matrix *(*hs_bindgen_test_array_75d83252a55a5c64 (void)) (void) { return &fun_14; } \n/* get_fun_15_ptr */ __attribute__ ((const)) signed int (*(*hs_bindgen_test_array_069ac2d1873f3210 (void)) (void))[][3] { return &fun_15; } \n/* get_fun_16_ptr */ __attribute__ ((const)) tripletlist *(*hs_bindgen_test_array_314971335aaa6db3 (void)) (void) { return &fun_16; } \n/* get_arr0_ptr */ __attribute__ ((const)) signed int (*hs_bindgen_test_array_a6413f4d2092265d (void))[3] { return &arr0; } \n/* get_arr1_ptr */ __attribute__ ((const)) signed int (*hs_bindgen_test_array_1693226264ba4aeb (void))[3] { return &arr1; } \n/* get_arr2_ptr */ __attribute__ ((const)) signed int (*hs_bindgen_test_array_dafcf99a73b93389 (void))[3] { return &arr2; } \n/* get_arr3_ptr */ __attribute__ ((const)) signed int (*hs_bindgen_test_array_ca1016acc3449dee (void))[3] { return &arr3; } \n/* get_arr6_ptr */ __attribute__ ((const)) signed int (*hs_bindgen_test_array_1a8c921160bc99a6 (void))[1] { return &arr6; } \n/* get_arr7_ptr */ __attribute__ ((const)) signed int (*hs_bindgen_test_array_17cf970243739b65 (void))[] { return &arr7; } \n/* get_arr_1_ptr */ __attribute__ ((const)) signed int (*hs_bindgen_test_array_85bc33b188037456 (void))[3] { return &arr_1; } \n/* get_arr_2_ptr */ __attribute__ ((const)) triplet *hs_bindgen_test_array_87c784150cd3ff65 (void) { return &arr_2; } \n/* get_arr_3_ptr */ __attribute__ ((const)) signed int (*hs_bindgen_test_array_e7b0de7633a7a62a (void))[] { return &arr_3; } \n/* get_arr_4_ptr */ __attribute__ ((const)) list *hs_bindgen_test_array_8fb64bc6c2bd4c73 (void) { return &arr_4; } \n/* get_arr_5_ptr */ __attribute__ ((const)) signed int (*hs_bindgen_test_array_7348a94e6adce96e (void))[4][3] { return &arr_5; } \n/* get_arr_6_ptr */ __attribute__ ((const)) matrix *hs_bindgen_test_array_1308613140bb4b80 (void) { return &arr_6; } \n/* get_arr_7_ptr */ __attribute__ ((const)) signed int (*hs_bindgen_test_array_a060984b378ed676 (void))[][3] { return &arr_7; } \n/* get_arr_8_ptr */ __attribute__ ((const)) tripletlist *hs_bindgen_test_array_d82706abb6d8ea04 (void) { return &arr_8; } \n") +$(HsBindgen.Runtime.Prelude.addCSource "#include \nsigned int hs_bindgen_test_array_5d1be223fd040c3b (signed int arg1, signed int *arg2) { return fun_1(arg1, arg2); }\nsigned int hs_bindgen_test_array_cabe35537b18e986 (signed int *arg1) { return fun_2(arg1); }\nsigned int hs_bindgen_test_array_4cdbf10236e78984 (signed int *arg1) { return fun_3(arg1); }\nsigned int hs_bindgen_test_array_e356c5ddb2608063 (signed int *arg1) { return fun_4(arg1); }\nsigned int hs_bindgen_test_array_f5ccf2c8d2e60be5 (signed int (*arg1)[3]) { return fun_5(arg1); }\nsigned int hs_bindgen_test_array_2b3a983697999524 (signed int (*arg1)[3]) { return fun_6(arg1); }\nsigned int hs_bindgen_test_array_72e9371a1b8b8907 (signed int (*arg1)[3]) { return fun_7(arg1); }\nsigned int hs_bindgen_test_array_62ad87463d9a75de (signed int (*arg1)[3]) { return fun_8(arg1); }\nsigned int hs_bindgen_test_array_2280ecc4c152a73f (triplet *arg1) { return isSolved(arg1); }\nsigned int (*hs_bindgen_test_array_d4c729a69c884fd4 (void))[3] { return fun_9(); }\ntriplet *hs_bindgen_test_array_bb92dfded907271e (void) { return fun_10(); }\nsigned int (*hs_bindgen_test_array_489aaaa59e992ddf (void))[] { return fun_11(); }\nlist *hs_bindgen_test_array_ee94c35f987d6c50 (void) { return fun_12(); }\nsigned int (*hs_bindgen_test_array_ca2c7b60ce85a964 (void))[4][3] { return fun_13(); }\nmatrix *hs_bindgen_test_array_ab2c533efdae8e41 (void) { return fun_14(); }\nsigned int (*hs_bindgen_test_array_019bdeb5db79cee1 (void))[][3] { return fun_15(); }\ntripletlist *hs_bindgen_test_array_ca0e7c51654fef12 (void) { return fun_16(); }\nsudoku *hs_bindgen_test_array_f6b66497ee1685b0 (void) { return solve(); }\n/* get_fun_1_ptr */ __attribute__ ((const)) signed int (*hs_bindgen_test_array_3ced2f3b2af806f8 (void)) (signed int arg1, signed int arg2[3]) { return &fun_1; } \n/* get_fun_2_ptr */ __attribute__ ((const)) signed int (*hs_bindgen_test_array_84966994a8d7df93 (void)) (triplet arg1) { return &fun_2; } \n/* get_fun_3_ptr */ __attribute__ ((const)) signed int (*hs_bindgen_test_array_3e6c940dbd7e5492 (void)) (signed int arg1[]) { return &fun_3; } \n/* get_fun_4_ptr */ __attribute__ ((const)) signed int (*hs_bindgen_test_array_d9f87d3e541b15e5 (void)) (list arg1) { return &fun_4; } \n/* get_fun_5_ptr */ __attribute__ ((const)) signed int (*hs_bindgen_test_array_cd41e41992d89300 (void)) (signed int arg1[4][3]) { return &fun_5; } \n/* get_fun_6_ptr */ __attribute__ ((const)) signed int (*hs_bindgen_test_array_db0e2655437ab8bb (void)) (matrix arg1) { return &fun_6; } \n/* get_fun_7_ptr */ __attribute__ ((const)) signed int (*hs_bindgen_test_array_9ec02aa16b020aa0 (void)) (signed int arg1[][3]) { return &fun_7; } \n/* get_fun_8_ptr */ __attribute__ ((const)) signed int (*hs_bindgen_test_array_a41b8d1332b69b95 (void)) (tripletlist arg1) { return &fun_8; } \n/* get_isSolved_ptr */ __attribute__ ((const)) signed int (*hs_bindgen_test_array_bdf2a6a8a3dd5b04 (void)) (sudoku arg1) { return &isSolved; } \n/* get_fun_9_ptr */ __attribute__ ((const)) signed int (*(*hs_bindgen_test_array_76f53f330102e743 (void)) (void))[3] { return &fun_9; } \n/* get_fun_10_ptr */ __attribute__ ((const)) triplet *(*hs_bindgen_test_array_abcc94f01de77b25 (void)) (void) { return &fun_10; } \n/* get_fun_11_ptr */ __attribute__ ((const)) signed int (*(*hs_bindgen_test_array_6661b46e4a751a85 (void)) (void))[] { return &fun_11; } \n/* get_fun_12_ptr */ __attribute__ ((const)) list *(*hs_bindgen_test_array_9c80a9e3300aad15 (void)) (void) { return &fun_12; } \n/* get_fun_13_ptr */ __attribute__ ((const)) signed int (*(*hs_bindgen_test_array_bb741b7e8c029e7e (void)) (void))[4][3] { return &fun_13; } \n/* get_fun_14_ptr */ __attribute__ ((const)) matrix *(*hs_bindgen_test_array_75d83252a55a5c64 (void)) (void) { return &fun_14; } \n/* get_fun_15_ptr */ __attribute__ ((const)) signed int (*(*hs_bindgen_test_array_069ac2d1873f3210 (void)) (void))[][3] { return &fun_15; } \n/* get_fun_16_ptr */ __attribute__ ((const)) tripletlist *(*hs_bindgen_test_array_314971335aaa6db3 (void)) (void) { return &fun_16; } \n/* get_solve_ptr */ __attribute__ ((const)) sudoku *(*hs_bindgen_test_array_9a62b5848be64bd4 (void)) (void) { return &solve; } \n/* get_arr0_ptr */ __attribute__ ((const)) signed int (*hs_bindgen_test_array_a6413f4d2092265d (void))[3] { return &arr0; } \n/* get_arr1_ptr */ __attribute__ ((const)) signed int (*hs_bindgen_test_array_1693226264ba4aeb (void))[3] { return &arr1; } \n/* get_arr2_ptr */ __attribute__ ((const)) signed int (*hs_bindgen_test_array_dafcf99a73b93389 (void))[3] { return &arr2; } \n/* get_arr3_ptr */ __attribute__ ((const)) signed int (*hs_bindgen_test_array_ca1016acc3449dee (void))[3] { return &arr3; } \n/* get_arr6_ptr */ __attribute__ ((const)) signed int (*hs_bindgen_test_array_1a8c921160bc99a6 (void))[1] { return &arr6; } \n/* get_arr7_ptr */ __attribute__ ((const)) signed int (*hs_bindgen_test_array_17cf970243739b65 (void))[] { return &arr7; } \n/* get_arr_1_ptr */ __attribute__ ((const)) signed int (*hs_bindgen_test_array_85bc33b188037456 (void))[3] { return &arr_1; } \n/* get_arr_2_ptr */ __attribute__ ((const)) triplet *hs_bindgen_test_array_87c784150cd3ff65 (void) { return &arr_2; } \n/* get_arr_3_ptr */ __attribute__ ((const)) signed int (*hs_bindgen_test_array_e7b0de7633a7a62a (void))[] { return &arr_3; } \n/* get_arr_4_ptr */ __attribute__ ((const)) list *hs_bindgen_test_array_8fb64bc6c2bd4c73 (void) { return &arr_4; } \n/* get_arr_5_ptr */ __attribute__ ((const)) signed int (*hs_bindgen_test_array_7348a94e6adce96e (void))[4][3] { return &arr_5; } \n/* get_arr_6_ptr */ __attribute__ ((const)) matrix *hs_bindgen_test_array_1308613140bb4b80 (void) { return &arr_6; } \n/* get_arr_7_ptr */ __attribute__ ((const)) signed int (*hs_bindgen_test_array_a060984b378ed676 (void))[][3] { return &arr_7; } \n/* get_arr_8_ptr */ __attribute__ ((const)) tripletlist *hs_bindgen_test_array_d82706abb6d8ea04 (void) { return &arr_8; } \n") {-| __C declaration:__ @triplet@ @@ -109,11 +109,25 @@ instance F.Storable Example where F.pokeByteOff ptr0 (0 :: Int) example_triple2 >> F.pokeByteOff ptr0 (12 :: Int) example_sudoku3 +{-| Typedef-in-typedef + +__C declaration:__ @sudoku@ + +__defined at:__ @array.h:55:17@ + +__exported by:__ @array.h@ +-} +newtype Sudoku = Sudoku + { un_Sudoku :: (HsBindgen.Runtime.ConstantArray.ConstantArray 3) Triplet + } + deriving stock (Eq, Show) + deriving newtype (F.Storable) + {-| Array of known size __C declaration:__ @fun_1@ -__defined at:__ @array.h:87:5@ +__defined at:__ @array.h:90:5@ __exported by:__ @array.h@ -} @@ -130,7 +144,7 @@ foreign import ccall safe "hs_bindgen_test_array_5d1be223fd040c3b" fun_1_wrapper __C declaration:__ @fun_1@ -__defined at:__ @array.h:87:5@ +__defined at:__ @array.h:90:5@ __exported by:__ @array.h@ -} @@ -145,7 +159,7 @@ fun_1 = __C declaration:__ @fun_2@ -__defined at:__ @array.h:90:5@ +__defined at:__ @array.h:93:5@ __exported by:__ @array.h@ -} @@ -159,7 +173,7 @@ foreign import ccall safe "hs_bindgen_test_array_cabe35537b18e986" fun_2_wrapper __C declaration:__ @fun_2@ -__defined at:__ @array.h:90:5@ +__defined at:__ @array.h:93:5@ __exported by:__ @array.h@ -} @@ -173,7 +187,7 @@ fun_2 = __C declaration:__ @fun_3@ -__defined at:__ @array.h:93:5@ +__defined at:__ @array.h:96:5@ __exported by:__ @array.h@ -} @@ -187,7 +201,7 @@ foreign import ccall safe "hs_bindgen_test_array_4cdbf10236e78984" fun_3_wrapper __C declaration:__ @fun_3@ -__defined at:__ @array.h:93:5@ +__defined at:__ @array.h:96:5@ __exported by:__ @array.h@ -} @@ -201,7 +215,7 @@ fun_3 = __C declaration:__ @fun_4@ -__defined at:__ @array.h:96:5@ +__defined at:__ @array.h:99:5@ __exported by:__ @array.h@ -} @@ -215,7 +229,7 @@ foreign import ccall safe "hs_bindgen_test_array_e356c5ddb2608063" fun_4_wrapper __C declaration:__ @fun_4@ -__defined at:__ @array.h:96:5@ +__defined at:__ @array.h:99:5@ __exported by:__ @array.h@ -} @@ -229,7 +243,7 @@ fun_4 = __C declaration:__ @fun_5@ -__defined at:__ @array.h:99:5@ +__defined at:__ @array.h:102:5@ __exported by:__ @array.h@ -} @@ -243,7 +257,7 @@ foreign import ccall safe "hs_bindgen_test_array_f5ccf2c8d2e60be5" fun_5_wrapper __C declaration:__ @fun_5@ -__defined at:__ @array.h:99:5@ +__defined at:__ @array.h:102:5@ __exported by:__ @array.h@ -} @@ -257,7 +271,7 @@ fun_5 = __C declaration:__ @fun_6@ -__defined at:__ @array.h:102:5@ +__defined at:__ @array.h:105:5@ __exported by:__ @array.h@ -} @@ -271,7 +285,7 @@ foreign import ccall safe "hs_bindgen_test_array_2b3a983697999524" fun_6_wrapper __C declaration:__ @fun_6@ -__defined at:__ @array.h:102:5@ +__defined at:__ @array.h:105:5@ __exported by:__ @array.h@ -} @@ -285,7 +299,7 @@ fun_6 = __C declaration:__ @fun_7@ -__defined at:__ @array.h:105:5@ +__defined at:__ @array.h:108:5@ __exported by:__ @array.h@ -} @@ -299,7 +313,7 @@ foreign import ccall safe "hs_bindgen_test_array_72e9371a1b8b8907" fun_7_wrapper __C declaration:__ @fun_7@ -__defined at:__ @array.h:105:5@ +__defined at:__ @array.h:108:5@ __exported by:__ @array.h@ -} @@ -313,7 +327,7 @@ fun_7 = __C declaration:__ @fun_8@ -__defined at:__ @array.h:108:5@ +__defined at:__ @array.h:111:5@ __exported by:__ @array.h@ -} @@ -327,7 +341,7 @@ foreign import ccall safe "hs_bindgen_test_array_62ad87463d9a75de" fun_8_wrapper __C declaration:__ @fun_8@ -__defined at:__ @array.h:108:5@ +__defined at:__ @array.h:111:5@ __exported by:__ @array.h@ -} @@ -337,11 +351,39 @@ fun_8 = HsBindgen.Runtime.IncompleteArray.withPtr x0 (\ptr1 -> fun_8_wrapper ptr1) +{-| Typedef-in-typedef + +__C declaration:__ @isSolved@ + +__defined at:__ @array.h:114:5@ + +__exported by:__ @array.h@ +-} +foreign import ccall safe "hs_bindgen_test_array_2280ecc4c152a73f" isSolved_wrapper + :: Ptr.Ptr Triplet + {- ^ __C declaration:__ @xss@ + -} + -> IO FC.CInt + +{-| Typedef-in-typedef + +__C declaration:__ @isSolved@ + +__defined at:__ @array.h:114:5@ + +__exported by:__ @array.h@ +-} +isSolved :: Sudoku -> IO FC.CInt +isSolved = + \x0 -> + HsBindgen.Runtime.ConstantArray.withPtr x0 (\ptr1 -> + isSolved_wrapper ptr1) + {-| Array of known size __C declaration:__ @fun_9@ -__defined at:__ @array.h:120:7@ +__defined at:__ @array.h:126:7@ __exported by:__ @array.h@ -} @@ -352,7 +394,7 @@ foreign import ccall safe "hs_bindgen_test_array_d4c729a69c884fd4" fun_9 __C declaration:__ @fun_10@ -__defined at:__ @array.h:123:10@ +__defined at:__ @array.h:129:10@ __exported by:__ @array.h@ -} @@ -363,7 +405,7 @@ foreign import ccall safe "hs_bindgen_test_array_bb92dfded907271e" fun_10 __C declaration:__ @fun_11@ -__defined at:__ @array.h:126:7@ +__defined at:__ @array.h:132:7@ __exported by:__ @array.h@ -} @@ -374,7 +416,7 @@ foreign import ccall safe "hs_bindgen_test_array_489aaaa59e992ddf" fun_11 __C declaration:__ @fun_12@ -__defined at:__ @array.h:129:7@ +__defined at:__ @array.h:135:7@ __exported by:__ @array.h@ -} @@ -385,7 +427,7 @@ foreign import ccall safe "hs_bindgen_test_array_ee94c35f987d6c50" fun_12 __C declaration:__ @fun_13@ -__defined at:__ @array.h:132:7@ +__defined at:__ @array.h:138:7@ __exported by:__ @array.h@ -} @@ -396,7 +438,7 @@ foreign import ccall safe "hs_bindgen_test_array_ca2c7b60ce85a964" fun_13 __C declaration:__ @fun_14@ -__defined at:__ @array.h:135:9@ +__defined at:__ @array.h:141:9@ __exported by:__ @array.h@ -} @@ -407,7 +449,7 @@ foreign import ccall safe "hs_bindgen_test_array_ab2c533efdae8e41" fun_14 __C declaration:__ @fun_15@ -__defined at:__ @array.h:138:7@ +__defined at:__ @array.h:144:7@ __exported by:__ @array.h@ -} @@ -418,13 +460,24 @@ foreign import ccall safe "hs_bindgen_test_array_019bdeb5db79cee1" fun_15 __C declaration:__ @fun_16@ -__defined at:__ @array.h:141:14@ +__defined at:__ @array.h:147:14@ __exported by:__ @array.h@ -} foreign import ccall safe "hs_bindgen_test_array_ca0e7c51654fef12" fun_16 :: IO (Ptr.Ptr Tripletlist) +{-| Typedef-in-typedef + +__C declaration:__ @solve@ + +__defined at:__ @array.h:150:10@ + +__exported by:__ @array.h@ +-} +foreign import ccall safe "hs_bindgen_test_array_f6b66497ee1685b0" solve + :: IO (Ptr.Ptr Sudoku) + foreign import ccall unsafe "hs_bindgen_test_array_3ced2f3b2af806f8" hs_bindgen_test_array_3ced2f3b2af806f8 :: IO (Ptr.FunPtr (FC.CInt -> ((HsBindgen.Runtime.ConstantArray.ConstantArray 3) FC.CInt) -> IO FC.CInt)) @@ -434,7 +487,7 @@ foreign import ccall unsafe "hs_bindgen_test_array_3ced2f3b2af806f8" hs_bindgen_ __C declaration:__ @fun_1@ -__defined at:__ @array.h:87:5@ +__defined at:__ @array.h:90:5@ __exported by:__ @array.h@ -} @@ -451,7 +504,7 @@ foreign import ccall unsafe "hs_bindgen_test_array_84966994a8d7df93" hs_bindgen_ __C declaration:__ @fun_2@ -__defined at:__ @array.h:90:5@ +__defined at:__ @array.h:93:5@ __exported by:__ @array.h@ -} @@ -468,7 +521,7 @@ foreign import ccall unsafe "hs_bindgen_test_array_3e6c940dbd7e5492" hs_bindgen_ __C declaration:__ @fun_3@ -__defined at:__ @array.h:93:5@ +__defined at:__ @array.h:96:5@ __exported by:__ @array.h@ -} @@ -485,7 +538,7 @@ foreign import ccall unsafe "hs_bindgen_test_array_d9f87d3e541b15e5" hs_bindgen_ __C declaration:__ @fun_4@ -__defined at:__ @array.h:96:5@ +__defined at:__ @array.h:99:5@ __exported by:__ @array.h@ -} @@ -502,7 +555,7 @@ foreign import ccall unsafe "hs_bindgen_test_array_cd41e41992d89300" hs_bindgen_ __C declaration:__ @fun_5@ -__defined at:__ @array.h:99:5@ +__defined at:__ @array.h:102:5@ __exported by:__ @array.h@ -} @@ -519,7 +572,7 @@ foreign import ccall unsafe "hs_bindgen_test_array_db0e2655437ab8bb" hs_bindgen_ __C declaration:__ @fun_6@ -__defined at:__ @array.h:102:5@ +__defined at:__ @array.h:105:5@ __exported by:__ @array.h@ -} @@ -536,7 +589,7 @@ foreign import ccall unsafe "hs_bindgen_test_array_9ec02aa16b020aa0" hs_bindgen_ __C declaration:__ @fun_7@ -__defined at:__ @array.h:105:5@ +__defined at:__ @array.h:108:5@ __exported by:__ @array.h@ -} @@ -553,7 +606,7 @@ foreign import ccall unsafe "hs_bindgen_test_array_a41b8d1332b69b95" hs_bindgen_ __C declaration:__ @fun_8@ -__defined at:__ @array.h:108:5@ +__defined at:__ @array.h:111:5@ __exported by:__ @array.h@ -} @@ -561,6 +614,23 @@ fun_8_ptr :: Ptr.FunPtr (Tripletlist -> IO FC.CInt) fun_8_ptr = GHC.IO.Unsafe.unsafePerformIO hs_bindgen_test_array_a41b8d1332b69b95 +foreign import ccall unsafe "hs_bindgen_test_array_bdf2a6a8a3dd5b04" hs_bindgen_test_array_bdf2a6a8a3dd5b04 + :: IO (Ptr.FunPtr (Sudoku -> IO FC.CInt)) + +{-# NOINLINE isSolved_ptr #-} + +{-| Typedef-in-typedef + +__C declaration:__ @isSolved@ + +__defined at:__ @array.h:114:5@ + +__exported by:__ @array.h@ +-} +isSolved_ptr :: Ptr.FunPtr (Sudoku -> IO FC.CInt) +isSolved_ptr = + GHC.IO.Unsafe.unsafePerformIO hs_bindgen_test_array_bdf2a6a8a3dd5b04 + foreign import ccall unsafe "hs_bindgen_test_array_76f53f330102e743" hs_bindgen_test_array_76f53f330102e743 :: IO (Ptr.FunPtr (IO (Ptr.Ptr ((HsBindgen.Runtime.ConstantArray.ConstantArray 3) FC.CInt)))) @@ -570,7 +640,7 @@ foreign import ccall unsafe "hs_bindgen_test_array_76f53f330102e743" hs_bindgen_ __C declaration:__ @fun_9@ -__defined at:__ @array.h:120:7@ +__defined at:__ @array.h:126:7@ __exported by:__ @array.h@ -} @@ -587,7 +657,7 @@ foreign import ccall unsafe "hs_bindgen_test_array_abcc94f01de77b25" hs_bindgen_ __C declaration:__ @fun_10@ -__defined at:__ @array.h:123:10@ +__defined at:__ @array.h:129:10@ __exported by:__ @array.h@ -} @@ -604,7 +674,7 @@ foreign import ccall unsafe "hs_bindgen_test_array_6661b46e4a751a85" hs_bindgen_ __C declaration:__ @fun_11@ -__defined at:__ @array.h:126:7@ +__defined at:__ @array.h:132:7@ __exported by:__ @array.h@ -} @@ -621,7 +691,7 @@ foreign import ccall unsafe "hs_bindgen_test_array_9c80a9e3300aad15" hs_bindgen_ __C declaration:__ @fun_12@ -__defined at:__ @array.h:129:7@ +__defined at:__ @array.h:135:7@ __exported by:__ @array.h@ -} @@ -638,7 +708,7 @@ foreign import ccall unsafe "hs_bindgen_test_array_bb741b7e8c029e7e" hs_bindgen_ __C declaration:__ @fun_13@ -__defined at:__ @array.h:132:7@ +__defined at:__ @array.h:138:7@ __exported by:__ @array.h@ -} @@ -655,7 +725,7 @@ foreign import ccall unsafe "hs_bindgen_test_array_75d83252a55a5c64" hs_bindgen_ __C declaration:__ @fun_14@ -__defined at:__ @array.h:135:9@ +__defined at:__ @array.h:141:9@ __exported by:__ @array.h@ -} @@ -672,7 +742,7 @@ foreign import ccall unsafe "hs_bindgen_test_array_069ac2d1873f3210" hs_bindgen_ __C declaration:__ @fun_15@ -__defined at:__ @array.h:138:7@ +__defined at:__ @array.h:144:7@ __exported by:__ @array.h@ -} @@ -689,7 +759,7 @@ foreign import ccall unsafe "hs_bindgen_test_array_314971335aaa6db3" hs_bindgen_ __C declaration:__ @fun_16@ -__defined at:__ @array.h:141:14@ +__defined at:__ @array.h:147:14@ __exported by:__ @array.h@ -} @@ -697,6 +767,23 @@ fun_16_ptr :: Ptr.FunPtr (IO (Ptr.Ptr Tripletlist)) fun_16_ptr = GHC.IO.Unsafe.unsafePerformIO hs_bindgen_test_array_314971335aaa6db3 +foreign import ccall unsafe "hs_bindgen_test_array_9a62b5848be64bd4" hs_bindgen_test_array_9a62b5848be64bd4 + :: IO (Ptr.FunPtr (IO (Ptr.Ptr Sudoku))) + +{-# NOINLINE solve_ptr #-} + +{-| Typedef-in-typedef + +__C declaration:__ @solve@ + +__defined at:__ @array.h:150:10@ + +__exported by:__ @array.h@ +-} +solve_ptr :: Ptr.FunPtr (IO (Ptr.Ptr Sudoku)) +solve_ptr = + GHC.IO.Unsafe.unsafePerformIO hs_bindgen_test_array_9a62b5848be64bd4 + foreign import ccall unsafe "hs_bindgen_test_array_a6413f4d2092265d" hs_bindgen_test_array_a6413f4d2092265d :: IO (Ptr.Ptr ((HsBindgen.Runtime.ConstantArray.ConstantArray 3) FC.CInt)) @@ -808,7 +895,7 @@ foreign import ccall unsafe "hs_bindgen_test_array_85bc33b188037456" hs_bindgen_ __C declaration:__ @arr_1@ -__defined at:__ @array.h:59:12@ +__defined at:__ @array.h:62:12@ __exported by:__ @array.h@ -} @@ -825,7 +912,7 @@ foreign import ccall unsafe "hs_bindgen_test_array_87c784150cd3ff65" hs_bindgen_ __C declaration:__ @arr_2@ -__defined at:__ @array.h:62:16@ +__defined at:__ @array.h:65:16@ __exported by:__ @array.h@ -} @@ -842,7 +929,7 @@ foreign import ccall unsafe "hs_bindgen_test_array_e7b0de7633a7a62a" hs_bindgen_ __C declaration:__ @arr_3@ -__defined at:__ @array.h:65:12@ +__defined at:__ @array.h:68:12@ __exported by:__ @array.h@ -} @@ -859,7 +946,7 @@ foreign import ccall unsafe "hs_bindgen_test_array_8fb64bc6c2bd4c73" hs_bindgen_ __C declaration:__ @arr_4@ -__defined at:__ @array.h:68:13@ +__defined at:__ @array.h:71:13@ __exported by:__ @array.h@ -} @@ -876,7 +963,7 @@ foreign import ccall unsafe "hs_bindgen_test_array_7348a94e6adce96e" hs_bindgen_ __C declaration:__ @arr_5@ -__defined at:__ @array.h:71:12@ +__defined at:__ @array.h:74:12@ __exported by:__ @array.h@ -} @@ -893,7 +980,7 @@ foreign import ccall unsafe "hs_bindgen_test_array_1308613140bb4b80" hs_bindgen_ __C declaration:__ @arr_6@ -__defined at:__ @array.h:74:15@ +__defined at:__ @array.h:77:15@ __exported by:__ @array.h@ -} @@ -910,7 +997,7 @@ foreign import ccall unsafe "hs_bindgen_test_array_a060984b378ed676" hs_bindgen_ __C declaration:__ @arr_7@ -__defined at:__ @array.h:77:12@ +__defined at:__ @array.h:80:12@ __exported by:__ @array.h@ -} @@ -927,7 +1014,7 @@ foreign import ccall unsafe "hs_bindgen_test_array_d82706abb6d8ea04" hs_bindgen_ __C declaration:__ @arr_8@ -__defined at:__ @array.h:80:20@ +__defined at:__ @array.h:83:20@ __exported by:__ @array.h@ -} diff --git a/hs-bindgen/fixtures/array.rs b/hs-bindgen/fixtures/array.rs index 335787bad..59f398edd 100644 --- a/hs-bindgen/fixtures/array.rs +++ b/hs-bindgen/fixtures/array.rs @@ -57,6 +57,8 @@ const _: () = { "Offset of field: Example::sudoku", ][::std::mem::offset_of!(Example, sudoku) - 12usize]; }; +///! Typedef-in-typedef +pub type sudoku = [triplet; 3usize]; unsafe extern "C" { ///! Array of known size pub static mut arr_1: [::std::os::raw::c_int; 3usize]; @@ -124,6 +126,10 @@ unsafe extern "C" { ///! Multi-dimensional array of unknown size, typedef pub fn fun_8(xss: *mut [::std::os::raw::c_int; 3usize]) -> ::std::os::raw::c_int; } +unsafe extern "C" { + ///! Typedef-in-typedef + pub fn isSolved(xss: *mut triplet) -> ::std::os::raw::c_int; +} unsafe extern "C" { ///! Array of known size pub fn fun_9() -> *mut [::std::os::raw::c_int; 3usize]; @@ -156,3 +162,7 @@ unsafe extern "C" { ///! Multi-dimensional array of unknown size, typedef pub fn fun_16() -> *mut tripletlist; } +unsafe extern "C" { + ///! Typedef-in-typedef + pub fn solve() -> *mut sudoku; +} diff --git a/hs-bindgen/fixtures/array.th.txt b/hs-bindgen/fixtures/array.th.txt index 7aff39e1c..5cef178b5 100644 --- a/hs-bindgen/fixtures/array.th.txt +++ b/hs-bindgen/fixtures/array.th.txt @@ -8,6 +8,7 @@ -- signed int hs_bindgen_test_array_2b3a983697999524 (signed int (*arg1)[3]) { return fun_6(arg1); } -- signed int hs_bindgen_test_array_72e9371a1b8b8907 (signed int (*arg1)[3]) { return fun_7(arg1); } -- signed int hs_bindgen_test_array_62ad87463d9a75de (signed int (*arg1)[3]) { return fun_8(arg1); } +-- signed int hs_bindgen_test_array_2280ecc4c152a73f (triplet *arg1) { return isSolved(arg1); } -- signed int (*hs_bindgen_test_array_d4c729a69c884fd4 (void))[3] { return fun_9(); } -- triplet *hs_bindgen_test_array_bb92dfded907271e (void) { return fun_10(); } -- signed int (*hs_bindgen_test_array_489aaaa59e992ddf (void))[] { return fun_11(); } @@ -16,6 +17,7 @@ -- matrix *hs_bindgen_test_array_ab2c533efdae8e41 (void) { return fun_14(); } -- signed int (*hs_bindgen_test_array_019bdeb5db79cee1 (void))[][3] { return fun_15(); } -- tripletlist *hs_bindgen_test_array_ca0e7c51654fef12 (void) { return fun_16(); } +-- sudoku *hs_bindgen_test_array_f6b66497ee1685b0 (void) { return solve(); } -- signed int hs_bindgen_test_array_38d1e706888c6509 (signed int arg1, signed int *arg2) { return fun_1(arg1, arg2); } -- signed int hs_bindgen_test_array_39ee469929b167e2 (signed int *arg1) { return fun_2(arg1); } -- signed int hs_bindgen_test_array_2aa49d73d177f65b (signed int *arg1) { return fun_3(arg1); } @@ -24,6 +26,7 @@ -- signed int hs_bindgen_test_array_a4600c666e12a07a (signed int (*arg1)[3]) { return fun_6(arg1); } -- signed int hs_bindgen_test_array_b903c9d5ebf4f21f (signed int (*arg1)[3]) { return fun_7(arg1); } -- signed int hs_bindgen_test_array_88af789e5a205473 (signed int (*arg1)[3]) { return fun_8(arg1); } +-- signed int hs_bindgen_test_array_617bd1cd5514ea45 (triplet *arg1) { return isSolved(arg1); } -- signed int (*hs_bindgen_test_array_49d4508b43473bd2 (void))[3] { return fun_9(); } -- triplet *hs_bindgen_test_array_d1763638472ee039 (void) { return fun_10(); } -- signed int (*hs_bindgen_test_array_293d2be6d282321b (void))[] { return fun_11(); } @@ -32,6 +35,7 @@ -- matrix *hs_bindgen_test_array_9d75a740147af339 (void) { return fun_14(); } -- signed int (*hs_bindgen_test_array_d49e5e7f4ad3c830 (void))[][3] { return fun_15(); } -- tripletlist *hs_bindgen_test_array_900726612f7787e4 (void) { return fun_16(); } +-- sudoku *hs_bindgen_test_array_ede6133d23ed3248 (void) { return solve(); } -- /* get_fun_1_ptr */ __attribute__ ((const)) signed int (*hs_bindgen_test_array_3ced2f3b2af806f8 (void)) (signed int arg1, signed int arg2[3]) { return &fun_1; } -- /* get_fun_2_ptr */ __attribute__ ((const)) signed int (*hs_bindgen_test_array_84966994a8d7df93 (void)) (triplet arg1) { return &fun_2; } -- /* get_fun_3_ptr */ __attribute__ ((const)) signed int (*hs_bindgen_test_array_3e6c940dbd7e5492 (void)) (signed int arg1[]) { return &fun_3; } @@ -40,6 +44,7 @@ -- /* get_fun_6_ptr */ __attribute__ ((const)) signed int (*hs_bindgen_test_array_db0e2655437ab8bb (void)) (matrix arg1) { return &fun_6; } -- /* get_fun_7_ptr */ __attribute__ ((const)) signed int (*hs_bindgen_test_array_9ec02aa16b020aa0 (void)) (signed int arg1[][3]) { return &fun_7; } -- /* get_fun_8_ptr */ __attribute__ ((const)) signed int (*hs_bindgen_test_array_a41b8d1332b69b95 (void)) (tripletlist arg1) { return &fun_8; } +-- /* get_isSolved_ptr */ __attribute__ ((const)) signed int (*hs_bindgen_test_array_bdf2a6a8a3dd5b04 (void)) (sudoku arg1) { return &isSolved; } -- /* get_fun_9_ptr */ __attribute__ ((const)) signed int (*(*hs_bindgen_test_array_76f53f330102e743 (void)) (void))[3] { return &fun_9; } -- /* get_fun_10_ptr */ __attribute__ ((const)) triplet *(*hs_bindgen_test_array_abcc94f01de77b25 (void)) (void) { return &fun_10; } -- /* get_fun_11_ptr */ __attribute__ ((const)) signed int (*(*hs_bindgen_test_array_6661b46e4a751a85 (void)) (void))[] { return &fun_11; } @@ -48,6 +53,7 @@ -- /* get_fun_14_ptr */ __attribute__ ((const)) matrix *(*hs_bindgen_test_array_75d83252a55a5c64 (void)) (void) { return &fun_14; } -- /* get_fun_15_ptr */ __attribute__ ((const)) signed int (*(*hs_bindgen_test_array_069ac2d1873f3210 (void)) (void))[][3] { return &fun_15; } -- /* get_fun_16_ptr */ __attribute__ ((const)) tripletlist *(*hs_bindgen_test_array_314971335aaa6db3 (void)) (void) { return &fun_16; } +-- /* get_solve_ptr */ __attribute__ ((const)) sudoku *(*hs_bindgen_test_array_9a62b5848be64bd4 (void)) (void) { return &solve; } -- /* get_arr0_ptr */ __attribute__ ((const)) signed int (*hs_bindgen_test_array_a6413f4d2092265d (void))[3] { return &arr0; } -- /* get_arr1_ptr */ __attribute__ ((const)) signed int (*hs_bindgen_test_array_1693226264ba4aeb (void))[3] { return &arr1; } -- /* get_arr2_ptr */ __attribute__ ((const)) signed int (*hs_bindgen_test_array_dafcf99a73b93389 (void))[3] { return &arr2; } @@ -160,11 +166,31 @@ instance Storable Example poke = \ptr_1 -> \s_2 -> case s_2 of Example example_triple_3 example_sudoku_4 -> pokeByteOff ptr_1 (0 :: Int) example_triple_3 >> pokeByteOff ptr_1 (12 :: Int) example_sudoku_4 +{-| Typedef-in-typedef + +__C declaration:__ @sudoku@ + +__defined at:__ @array.h:55:17@ + +__exported by:__ @array.h@ +-} +newtype Sudoku + = Sudoku {un_Sudoku :: (ConstantArray 3 Triplet)} + {- ^ Typedef-in-typedef + + __C declaration:__ @sudoku@ + + __defined at:__ @array.h:55:17@ + + __exported by:__ @array.h@ + -} + deriving stock (Eq, Show) + deriving newtype Storable {-| Array of known size __C declaration:__ @fun_1@ -__defined at:__ @array.h:87:5@ +__defined at:__ @array.h:90:5@ __exported by:__ @array.h@ -} @@ -175,7 +201,7 @@ foreign import ccall safe "hs_bindgen_test_array_5d1be223fd040c3b" fun_1_wrapper __C declaration:__ @fun_1@ -__defined at:__ @array.h:87:5@ +__defined at:__ @array.h:90:5@ __exported by:__ @array.h@ -} @@ -184,7 +210,7 @@ fun_1 :: CInt -> ConstantArray 3 CInt -> IO CInt __C declaration:__ @fun_1@ -__defined at:__ @array.h:87:5@ +__defined at:__ @array.h:90:5@ __exported by:__ @array.h@ -} @@ -193,7 +219,7 @@ fun_1 = \x_0 -> \x_1 -> withPtr x_1 (\ptr_2 -> fun_1_wrapper x_0 ptr_2) __C declaration:__ @fun_2@ -__defined at:__ @array.h:90:5@ +__defined at:__ @array.h:93:5@ __exported by:__ @array.h@ -} @@ -203,7 +229,7 @@ foreign import ccall safe "hs_bindgen_test_array_cabe35537b18e986" fun_2_wrapper __C declaration:__ @fun_2@ -__defined at:__ @array.h:90:5@ +__defined at:__ @array.h:93:5@ __exported by:__ @array.h@ -} @@ -212,7 +238,7 @@ fun_2 :: Triplet -> IO CInt __C declaration:__ @fun_2@ -__defined at:__ @array.h:90:5@ +__defined at:__ @array.h:93:5@ __exported by:__ @array.h@ -} @@ -221,7 +247,7 @@ fun_2 = \x_0 -> withPtr x_0 (\ptr_1 -> fun_2_wrapper ptr_1) __C declaration:__ @fun_3@ -__defined at:__ @array.h:93:5@ +__defined at:__ @array.h:96:5@ __exported by:__ @array.h@ -} @@ -231,7 +257,7 @@ foreign import ccall safe "hs_bindgen_test_array_4cdbf10236e78984" fun_3_wrapper __C declaration:__ @fun_3@ -__defined at:__ @array.h:93:5@ +__defined at:__ @array.h:96:5@ __exported by:__ @array.h@ -} @@ -240,7 +266,7 @@ fun_3 :: IncompleteArray CInt -> IO CInt __C declaration:__ @fun_3@ -__defined at:__ @array.h:93:5@ +__defined at:__ @array.h:96:5@ __exported by:__ @array.h@ -} @@ -249,7 +275,7 @@ fun_3 = \x_0 -> withPtr x_0 (\ptr_1 -> fun_3_wrapper ptr_1) __C declaration:__ @fun_4@ -__defined at:__ @array.h:96:5@ +__defined at:__ @array.h:99:5@ __exported by:__ @array.h@ -} @@ -259,7 +285,7 @@ foreign import ccall safe "hs_bindgen_test_array_e356c5ddb2608063" fun_4_wrapper __C declaration:__ @fun_4@ -__defined at:__ @array.h:96:5@ +__defined at:__ @array.h:99:5@ __exported by:__ @array.h@ -} @@ -268,7 +294,7 @@ fun_4 :: List -> IO CInt __C declaration:__ @fun_4@ -__defined at:__ @array.h:96:5@ +__defined at:__ @array.h:99:5@ __exported by:__ @array.h@ -} @@ -277,7 +303,7 @@ fun_4 = \x_0 -> withPtr x_0 (\ptr_1 -> fun_4_wrapper ptr_1) __C declaration:__ @fun_5@ -__defined at:__ @array.h:99:5@ +__defined at:__ @array.h:102:5@ __exported by:__ @array.h@ -} @@ -288,7 +314,7 @@ foreign import ccall safe "hs_bindgen_test_array_f5ccf2c8d2e60be5" fun_5_wrapper __C declaration:__ @fun_5@ -__defined at:__ @array.h:99:5@ +__defined at:__ @array.h:102:5@ __exported by:__ @array.h@ -} @@ -297,7 +323,7 @@ fun_5 :: ConstantArray 4 (ConstantArray 3 CInt) -> IO CInt __C declaration:__ @fun_5@ -__defined at:__ @array.h:99:5@ +__defined at:__ @array.h:102:5@ __exported by:__ @array.h@ -} @@ -306,7 +332,7 @@ fun_5 = \x_0 -> withPtr x_0 (\ptr_1 -> fun_5_wrapper ptr_1) __C declaration:__ @fun_6@ -__defined at:__ @array.h:102:5@ +__defined at:__ @array.h:105:5@ __exported by:__ @array.h@ -} @@ -317,7 +343,7 @@ foreign import ccall safe "hs_bindgen_test_array_2b3a983697999524" fun_6_wrapper __C declaration:__ @fun_6@ -__defined at:__ @array.h:102:5@ +__defined at:__ @array.h:105:5@ __exported by:__ @array.h@ -} @@ -326,7 +352,7 @@ fun_6 :: Matrix -> IO CInt __C declaration:__ @fun_6@ -__defined at:__ @array.h:102:5@ +__defined at:__ @array.h:105:5@ __exported by:__ @array.h@ -} @@ -335,7 +361,7 @@ fun_6 = \x_0 -> withPtr x_0 (\ptr_1 -> fun_6_wrapper ptr_1) __C declaration:__ @fun_7@ -__defined at:__ @array.h:105:5@ +__defined at:__ @array.h:108:5@ __exported by:__ @array.h@ -} @@ -346,7 +372,7 @@ foreign import ccall safe "hs_bindgen_test_array_72e9371a1b8b8907" fun_7_wrapper __C declaration:__ @fun_7@ -__defined at:__ @array.h:105:5@ +__defined at:__ @array.h:108:5@ __exported by:__ @array.h@ -} @@ -355,7 +381,7 @@ fun_7 :: IncompleteArray (ConstantArray 3 CInt) -> IO CInt __C declaration:__ @fun_7@ -__defined at:__ @array.h:105:5@ +__defined at:__ @array.h:108:5@ __exported by:__ @array.h@ -} @@ -364,7 +390,7 @@ fun_7 = \x_0 -> withPtr x_0 (\ptr_1 -> fun_7_wrapper ptr_1) __C declaration:__ @fun_8@ -__defined at:__ @array.h:108:5@ +__defined at:__ @array.h:111:5@ __exported by:__ @array.h@ -} @@ -375,7 +401,7 @@ foreign import ccall safe "hs_bindgen_test_array_62ad87463d9a75de" fun_8_wrapper __C declaration:__ @fun_8@ -__defined at:__ @array.h:108:5@ +__defined at:__ @array.h:111:5@ __exported by:__ @array.h@ -} @@ -384,16 +410,44 @@ fun_8 :: Tripletlist -> IO CInt __C declaration:__ @fun_8@ -__defined at:__ @array.h:108:5@ +__defined at:__ @array.h:111:5@ __exported by:__ @array.h@ -} fun_8 = \x_0 -> withPtr x_0 (\ptr_1 -> fun_8_wrapper ptr_1) +{-| Typedef-in-typedef + +__C declaration:__ @isSolved@ + +__defined at:__ @array.h:114:5@ + +__exported by:__ @array.h@ +-} +foreign import ccall safe "hs_bindgen_test_array_2280ecc4c152a73f" isSolved_wrapper :: Ptr Triplet -> + IO CInt +{-| Typedef-in-typedef + +__C declaration:__ @isSolved@ + +__defined at:__ @array.h:114:5@ + +__exported by:__ @array.h@ +-} +isSolved :: Sudoku -> IO CInt +{-| Typedef-in-typedef + +__C declaration:__ @isSolved@ + +__defined at:__ @array.h:114:5@ + +__exported by:__ @array.h@ +-} +isSolved = \x_0 -> withPtr x_0 (\ptr_1 -> isSolved_wrapper ptr_1) {-| Array of known size __C declaration:__ @fun_9@ -__defined at:__ @array.h:120:7@ +__defined at:__ @array.h:126:7@ __exported by:__ @array.h@ -} @@ -403,7 +457,7 @@ foreign import ccall safe "hs_bindgen_test_array_d4c729a69c884fd4" fun_9 :: IO ( __C declaration:__ @fun_10@ -__defined at:__ @array.h:123:10@ +__defined at:__ @array.h:129:10@ __exported by:__ @array.h@ -} @@ -412,7 +466,7 @@ foreign import ccall safe "hs_bindgen_test_array_bb92dfded907271e" fun_10 :: IO __C declaration:__ @fun_11@ -__defined at:__ @array.h:126:7@ +__defined at:__ @array.h:132:7@ __exported by:__ @array.h@ -} @@ -421,7 +475,7 @@ foreign import ccall safe "hs_bindgen_test_array_489aaaa59e992ddf" fun_11 :: IO __C declaration:__ @fun_12@ -__defined at:__ @array.h:129:7@ +__defined at:__ @array.h:135:7@ __exported by:__ @array.h@ -} @@ -430,7 +484,7 @@ foreign import ccall safe "hs_bindgen_test_array_ee94c35f987d6c50" fun_12 :: IO __C declaration:__ @fun_13@ -__defined at:__ @array.h:132:7@ +__defined at:__ @array.h:138:7@ __exported by:__ @array.h@ -} @@ -441,7 +495,7 @@ foreign import ccall safe "hs_bindgen_test_array_ca2c7b60ce85a964" fun_13 :: IO __C declaration:__ @fun_14@ -__defined at:__ @array.h:135:9@ +__defined at:__ @array.h:141:9@ __exported by:__ @array.h@ -} @@ -450,7 +504,7 @@ foreign import ccall safe "hs_bindgen_test_array_ab2c533efdae8e41" fun_14 :: IO __C declaration:__ @fun_15@ -__defined at:__ @array.h:138:7@ +__defined at:__ @array.h:144:7@ __exported by:__ @array.h@ -} @@ -460,16 +514,25 @@ foreign import ccall safe "hs_bindgen_test_array_019bdeb5db79cee1" fun_15 :: IO __C declaration:__ @fun_16@ -__defined at:__ @array.h:141:14@ +__defined at:__ @array.h:147:14@ __exported by:__ @array.h@ -} foreign import ccall safe "hs_bindgen_test_array_ca0e7c51654fef12" fun_16 :: IO (Ptr Tripletlist) +{-| Typedef-in-typedef + +__C declaration:__ @solve@ + +__defined at:__ @array.h:150:10@ + +__exported by:__ @array.h@ +-} +foreign import ccall safe "hs_bindgen_test_array_f6b66497ee1685b0" solve :: IO (Ptr Sudoku) {-| Array of known size __C declaration:__ @fun_1@ -__defined at:__ @array.h:87:5@ +__defined at:__ @array.h:90:5@ __exported by:__ @array.h@ -} @@ -480,7 +543,7 @@ foreign import ccall safe "hs_bindgen_test_array_38d1e706888c6509" fun_1_wrapper __C declaration:__ @fun_1@ -__defined at:__ @array.h:87:5@ +__defined at:__ @array.h:90:5@ __exported by:__ @array.h@ -} @@ -489,7 +552,7 @@ fun_1 :: CInt -> ConstantArray 3 CInt -> IO CInt __C declaration:__ @fun_1@ -__defined at:__ @array.h:87:5@ +__defined at:__ @array.h:90:5@ __exported by:__ @array.h@ -} @@ -498,7 +561,7 @@ fun_1 = \x_0 -> \x_1 -> withPtr x_1 (\ptr_2 -> fun_1_wrapper x_0 ptr_2) __C declaration:__ @fun_2@ -__defined at:__ @array.h:90:5@ +__defined at:__ @array.h:93:5@ __exported by:__ @array.h@ -} @@ -508,7 +571,7 @@ foreign import ccall safe "hs_bindgen_test_array_39ee469929b167e2" fun_2_wrapper __C declaration:__ @fun_2@ -__defined at:__ @array.h:90:5@ +__defined at:__ @array.h:93:5@ __exported by:__ @array.h@ -} @@ -517,7 +580,7 @@ fun_2 :: Triplet -> IO CInt __C declaration:__ @fun_2@ -__defined at:__ @array.h:90:5@ +__defined at:__ @array.h:93:5@ __exported by:__ @array.h@ -} @@ -526,7 +589,7 @@ fun_2 = \x_0 -> withPtr x_0 (\ptr_1 -> fun_2_wrapper ptr_1) __C declaration:__ @fun_3@ -__defined at:__ @array.h:93:5@ +__defined at:__ @array.h:96:5@ __exported by:__ @array.h@ -} @@ -536,7 +599,7 @@ foreign import ccall safe "hs_bindgen_test_array_2aa49d73d177f65b" fun_3_wrapper __C declaration:__ @fun_3@ -__defined at:__ @array.h:93:5@ +__defined at:__ @array.h:96:5@ __exported by:__ @array.h@ -} @@ -545,7 +608,7 @@ fun_3 :: IncompleteArray CInt -> IO CInt __C declaration:__ @fun_3@ -__defined at:__ @array.h:93:5@ +__defined at:__ @array.h:96:5@ __exported by:__ @array.h@ -} @@ -554,7 +617,7 @@ fun_3 = \x_0 -> withPtr x_0 (\ptr_1 -> fun_3_wrapper ptr_1) __C declaration:__ @fun_4@ -__defined at:__ @array.h:96:5@ +__defined at:__ @array.h:99:5@ __exported by:__ @array.h@ -} @@ -564,7 +627,7 @@ foreign import ccall safe "hs_bindgen_test_array_c3b2941d43616704" fun_4_wrapper __C declaration:__ @fun_4@ -__defined at:__ @array.h:96:5@ +__defined at:__ @array.h:99:5@ __exported by:__ @array.h@ -} @@ -573,7 +636,7 @@ fun_4 :: List -> IO CInt __C declaration:__ @fun_4@ -__defined at:__ @array.h:96:5@ +__defined at:__ @array.h:99:5@ __exported by:__ @array.h@ -} @@ -582,7 +645,7 @@ fun_4 = \x_0 -> withPtr x_0 (\ptr_1 -> fun_4_wrapper ptr_1) __C declaration:__ @fun_5@ -__defined at:__ @array.h:99:5@ +__defined at:__ @array.h:102:5@ __exported by:__ @array.h@ -} @@ -593,7 +656,7 @@ foreign import ccall safe "hs_bindgen_test_array_69ec2f59c3c40de4" fun_5_wrapper __C declaration:__ @fun_5@ -__defined at:__ @array.h:99:5@ +__defined at:__ @array.h:102:5@ __exported by:__ @array.h@ -} @@ -602,7 +665,7 @@ fun_5 :: ConstantArray 4 (ConstantArray 3 CInt) -> IO CInt __C declaration:__ @fun_5@ -__defined at:__ @array.h:99:5@ +__defined at:__ @array.h:102:5@ __exported by:__ @array.h@ -} @@ -611,7 +674,7 @@ fun_5 = \x_0 -> withPtr x_0 (\ptr_1 -> fun_5_wrapper ptr_1) __C declaration:__ @fun_6@ -__defined at:__ @array.h:102:5@ +__defined at:__ @array.h:105:5@ __exported by:__ @array.h@ -} @@ -622,7 +685,7 @@ foreign import ccall safe "hs_bindgen_test_array_a4600c666e12a07a" fun_6_wrapper __C declaration:__ @fun_6@ -__defined at:__ @array.h:102:5@ +__defined at:__ @array.h:105:5@ __exported by:__ @array.h@ -} @@ -631,7 +694,7 @@ fun_6 :: Matrix -> IO CInt __C declaration:__ @fun_6@ -__defined at:__ @array.h:102:5@ +__defined at:__ @array.h:105:5@ __exported by:__ @array.h@ -} @@ -640,7 +703,7 @@ fun_6 = \x_0 -> withPtr x_0 (\ptr_1 -> fun_6_wrapper ptr_1) __C declaration:__ @fun_7@ -__defined at:__ @array.h:105:5@ +__defined at:__ @array.h:108:5@ __exported by:__ @array.h@ -} @@ -651,7 +714,7 @@ foreign import ccall safe "hs_bindgen_test_array_b903c9d5ebf4f21f" fun_7_wrapper __C declaration:__ @fun_7@ -__defined at:__ @array.h:105:5@ +__defined at:__ @array.h:108:5@ __exported by:__ @array.h@ -} @@ -660,7 +723,7 @@ fun_7 :: IncompleteArray (ConstantArray 3 CInt) -> IO CInt __C declaration:__ @fun_7@ -__defined at:__ @array.h:105:5@ +__defined at:__ @array.h:108:5@ __exported by:__ @array.h@ -} @@ -669,7 +732,7 @@ fun_7 = \x_0 -> withPtr x_0 (\ptr_1 -> fun_7_wrapper ptr_1) __C declaration:__ @fun_8@ -__defined at:__ @array.h:108:5@ +__defined at:__ @array.h:111:5@ __exported by:__ @array.h@ -} @@ -680,7 +743,7 @@ foreign import ccall safe "hs_bindgen_test_array_88af789e5a205473" fun_8_wrapper __C declaration:__ @fun_8@ -__defined at:__ @array.h:108:5@ +__defined at:__ @array.h:111:5@ __exported by:__ @array.h@ -} @@ -689,16 +752,44 @@ fun_8 :: Tripletlist -> IO CInt __C declaration:__ @fun_8@ -__defined at:__ @array.h:108:5@ +__defined at:__ @array.h:111:5@ __exported by:__ @array.h@ -} fun_8 = \x_0 -> withPtr x_0 (\ptr_1 -> fun_8_wrapper ptr_1) +{-| Typedef-in-typedef + +__C declaration:__ @isSolved@ + +__defined at:__ @array.h:114:5@ + +__exported by:__ @array.h@ +-} +foreign import ccall safe "hs_bindgen_test_array_617bd1cd5514ea45" isSolved_wrapper :: Ptr Triplet -> + IO CInt +{-| Typedef-in-typedef + +__C declaration:__ @isSolved@ + +__defined at:__ @array.h:114:5@ + +__exported by:__ @array.h@ +-} +isSolved :: Sudoku -> IO CInt +{-| Typedef-in-typedef + +__C declaration:__ @isSolved@ + +__defined at:__ @array.h:114:5@ + +__exported by:__ @array.h@ +-} +isSolved = \x_0 -> withPtr x_0 (\ptr_1 -> isSolved_wrapper ptr_1) {-| Array of known size __C declaration:__ @fun_9@ -__defined at:__ @array.h:120:7@ +__defined at:__ @array.h:126:7@ __exported by:__ @array.h@ -} @@ -708,7 +799,7 @@ foreign import ccall safe "hs_bindgen_test_array_49d4508b43473bd2" fun_9 :: IO ( __C declaration:__ @fun_10@ -__defined at:__ @array.h:123:10@ +__defined at:__ @array.h:129:10@ __exported by:__ @array.h@ -} @@ -717,7 +808,7 @@ foreign import ccall safe "hs_bindgen_test_array_d1763638472ee039" fun_10 :: IO __C declaration:__ @fun_11@ -__defined at:__ @array.h:126:7@ +__defined at:__ @array.h:132:7@ __exported by:__ @array.h@ -} @@ -726,7 +817,7 @@ foreign import ccall safe "hs_bindgen_test_array_293d2be6d282321b" fun_11 :: IO __C declaration:__ @fun_12@ -__defined at:__ @array.h:129:7@ +__defined at:__ @array.h:135:7@ __exported by:__ @array.h@ -} @@ -735,7 +826,7 @@ foreign import ccall safe "hs_bindgen_test_array_fe193d0e0c330960" fun_12 :: IO __C declaration:__ @fun_13@ -__defined at:__ @array.h:132:7@ +__defined at:__ @array.h:138:7@ __exported by:__ @array.h@ -} @@ -746,7 +837,7 @@ foreign import ccall safe "hs_bindgen_test_array_f3df0067620bd691" fun_13 :: IO __C declaration:__ @fun_14@ -__defined at:__ @array.h:135:9@ +__defined at:__ @array.h:141:9@ __exported by:__ @array.h@ -} @@ -755,7 +846,7 @@ foreign import ccall safe "hs_bindgen_test_array_9d75a740147af339" fun_14 :: IO __C declaration:__ @fun_15@ -__defined at:__ @array.h:138:7@ +__defined at:__ @array.h:144:7@ __exported by:__ @array.h@ -} @@ -765,11 +856,20 @@ foreign import ccall safe "hs_bindgen_test_array_d49e5e7f4ad3c830" fun_15 :: IO __C declaration:__ @fun_16@ -__defined at:__ @array.h:141:14@ +__defined at:__ @array.h:147:14@ __exported by:__ @array.h@ -} foreign import ccall safe "hs_bindgen_test_array_900726612f7787e4" fun_16 :: IO (Ptr Tripletlist) +{-| Typedef-in-typedef + +__C declaration:__ @solve@ + +__defined at:__ @array.h:150:10@ + +__exported by:__ @array.h@ +-} +foreign import ccall safe "hs_bindgen_test_array_ede6133d23ed3248" solve :: IO (Ptr Sudoku) foreign import ccall safe "hs_bindgen_test_array_3ced2f3b2af806f8" hs_bindgen_test_array_3ced2f3b2af806f8 :: IO (FunPtr (CInt -> ConstantArray 3 CInt -> @@ -779,7 +879,7 @@ foreign import ccall safe "hs_bindgen_test_array_3ced2f3b2af806f8" hs_bindgen_te __C declaration:__ @fun_1@ -__defined at:__ @array.h:87:5@ +__defined at:__ @array.h:90:5@ __exported by:__ @array.h@ -} @@ -788,7 +888,7 @@ fun_1_ptr :: FunPtr (CInt -> ConstantArray 3 CInt -> IO CInt) __C declaration:__ @fun_1@ -__defined at:__ @array.h:87:5@ +__defined at:__ @array.h:90:5@ __exported by:__ @array.h@ -} @@ -800,7 +900,7 @@ foreign import ccall safe "hs_bindgen_test_array_84966994a8d7df93" hs_bindgen_te __C declaration:__ @fun_2@ -__defined at:__ @array.h:90:5@ +__defined at:__ @array.h:93:5@ __exported by:__ @array.h@ -} @@ -809,7 +909,7 @@ fun_2_ptr :: FunPtr (Triplet -> IO CInt) __C declaration:__ @fun_2@ -__defined at:__ @array.h:90:5@ +__defined at:__ @array.h:93:5@ __exported by:__ @array.h@ -} @@ -821,7 +921,7 @@ foreign import ccall safe "hs_bindgen_test_array_3e6c940dbd7e5492" hs_bindgen_te __C declaration:__ @fun_3@ -__defined at:__ @array.h:93:5@ +__defined at:__ @array.h:96:5@ __exported by:__ @array.h@ -} @@ -830,7 +930,7 @@ fun_3_ptr :: FunPtr (IncompleteArray CInt -> IO CInt) __C declaration:__ @fun_3@ -__defined at:__ @array.h:93:5@ +__defined at:__ @array.h:96:5@ __exported by:__ @array.h@ -} @@ -842,7 +942,7 @@ foreign import ccall safe "hs_bindgen_test_array_d9f87d3e541b15e5" hs_bindgen_te __C declaration:__ @fun_4@ -__defined at:__ @array.h:96:5@ +__defined at:__ @array.h:99:5@ __exported by:__ @array.h@ -} @@ -851,7 +951,7 @@ fun_4_ptr :: FunPtr (List -> IO CInt) __C declaration:__ @fun_4@ -__defined at:__ @array.h:96:5@ +__defined at:__ @array.h:99:5@ __exported by:__ @array.h@ -} @@ -865,7 +965,7 @@ foreign import ccall safe "hs_bindgen_test_array_cd41e41992d89300" hs_bindgen_te __C declaration:__ @fun_5@ -__defined at:__ @array.h:99:5@ +__defined at:__ @array.h:102:5@ __exported by:__ @array.h@ -} @@ -875,7 +975,7 @@ fun_5_ptr :: FunPtr (ConstantArray 4 (ConstantArray 3 CInt) -> __C declaration:__ @fun_5@ -__defined at:__ @array.h:99:5@ +__defined at:__ @array.h:102:5@ __exported by:__ @array.h@ -} @@ -887,7 +987,7 @@ foreign import ccall safe "hs_bindgen_test_array_db0e2655437ab8bb" hs_bindgen_te __C declaration:__ @fun_6@ -__defined at:__ @array.h:102:5@ +__defined at:__ @array.h:105:5@ __exported by:__ @array.h@ -} @@ -896,7 +996,7 @@ fun_6_ptr :: FunPtr (Matrix -> IO CInt) __C declaration:__ @fun_6@ -__defined at:__ @array.h:102:5@ +__defined at:__ @array.h:105:5@ __exported by:__ @array.h@ -} @@ -909,7 +1009,7 @@ foreign import ccall safe "hs_bindgen_test_array_9ec02aa16b020aa0" hs_bindgen_te __C declaration:__ @fun_7@ -__defined at:__ @array.h:105:5@ +__defined at:__ @array.h:108:5@ __exported by:__ @array.h@ -} @@ -919,7 +1019,7 @@ fun_7_ptr :: FunPtr (IncompleteArray (ConstantArray 3 CInt) -> __C declaration:__ @fun_7@ -__defined at:__ @array.h:105:5@ +__defined at:__ @array.h:108:5@ __exported by:__ @array.h@ -} @@ -931,7 +1031,7 @@ foreign import ccall safe "hs_bindgen_test_array_a41b8d1332b69b95" hs_bindgen_te __C declaration:__ @fun_8@ -__defined at:__ @array.h:108:5@ +__defined at:__ @array.h:111:5@ __exported by:__ @array.h@ -} @@ -940,11 +1040,32 @@ fun_8_ptr :: FunPtr (Tripletlist -> IO CInt) __C declaration:__ @fun_8@ -__defined at:__ @array.h:108:5@ +__defined at:__ @array.h:111:5@ __exported by:__ @array.h@ -} fun_8_ptr = unsafePerformIO hs_bindgen_test_array_a41b8d1332b69b95 +foreign import ccall safe "hs_bindgen_test_array_bdf2a6a8a3dd5b04" hs_bindgen_test_array_bdf2a6a8a3dd5b04 :: IO (FunPtr (Sudoku -> + IO CInt)) +{-# NOINLINE isSolved_ptr #-} +{-| Typedef-in-typedef + +__C declaration:__ @isSolved@ + +__defined at:__ @array.h:114:5@ + +__exported by:__ @array.h@ +-} +isSolved_ptr :: FunPtr (Sudoku -> IO CInt) +{-| Typedef-in-typedef + +__C declaration:__ @isSolved@ + +__defined at:__ @array.h:114:5@ + +__exported by:__ @array.h@ +-} +isSolved_ptr = unsafePerformIO hs_bindgen_test_array_bdf2a6a8a3dd5b04 foreign import ccall safe "hs_bindgen_test_array_76f53f330102e743" hs_bindgen_test_array_76f53f330102e743 :: IO (FunPtr (IO (Ptr (ConstantArray 3 CInt)))) {-# NOINLINE fun_9_ptr #-} @@ -952,7 +1073,7 @@ foreign import ccall safe "hs_bindgen_test_array_76f53f330102e743" hs_bindgen_te __C declaration:__ @fun_9@ -__defined at:__ @array.h:120:7@ +__defined at:__ @array.h:126:7@ __exported by:__ @array.h@ -} @@ -961,7 +1082,7 @@ fun_9_ptr :: FunPtr (IO (Ptr (ConstantArray 3 CInt))) __C declaration:__ @fun_9@ -__defined at:__ @array.h:120:7@ +__defined at:__ @array.h:126:7@ __exported by:__ @array.h@ -} @@ -972,7 +1093,7 @@ foreign import ccall safe "hs_bindgen_test_array_abcc94f01de77b25" hs_bindgen_te __C declaration:__ @fun_10@ -__defined at:__ @array.h:123:10@ +__defined at:__ @array.h:129:10@ __exported by:__ @array.h@ -} @@ -981,7 +1102,7 @@ fun_10_ptr :: FunPtr (IO (Ptr Triplet)) __C declaration:__ @fun_10@ -__defined at:__ @array.h:123:10@ +__defined at:__ @array.h:129:10@ __exported by:__ @array.h@ -} @@ -992,7 +1113,7 @@ foreign import ccall safe "hs_bindgen_test_array_6661b46e4a751a85" hs_bindgen_te __C declaration:__ @fun_11@ -__defined at:__ @array.h:126:7@ +__defined at:__ @array.h:132:7@ __exported by:__ @array.h@ -} @@ -1001,7 +1122,7 @@ fun_11_ptr :: FunPtr (IO (Ptr (IncompleteArray CInt))) __C declaration:__ @fun_11@ -__defined at:__ @array.h:126:7@ +__defined at:__ @array.h:132:7@ __exported by:__ @array.h@ -} @@ -1012,7 +1133,7 @@ foreign import ccall safe "hs_bindgen_test_array_9c80a9e3300aad15" hs_bindgen_te __C declaration:__ @fun_12@ -__defined at:__ @array.h:129:7@ +__defined at:__ @array.h:135:7@ __exported by:__ @array.h@ -} @@ -1021,7 +1142,7 @@ fun_12_ptr :: FunPtr (IO (Ptr List)) __C declaration:__ @fun_12@ -__defined at:__ @array.h:129:7@ +__defined at:__ @array.h:135:7@ __exported by:__ @array.h@ -} @@ -1034,7 +1155,7 @@ foreign import ccall safe "hs_bindgen_test_array_bb741b7e8c029e7e" hs_bindgen_te __C declaration:__ @fun_13@ -__defined at:__ @array.h:132:7@ +__defined at:__ @array.h:138:7@ __exported by:__ @array.h@ -} @@ -1044,7 +1165,7 @@ fun_13_ptr :: FunPtr (IO (Ptr (ConstantArray 4 __C declaration:__ @fun_13@ -__defined at:__ @array.h:132:7@ +__defined at:__ @array.h:138:7@ __exported by:__ @array.h@ -} @@ -1055,7 +1176,7 @@ foreign import ccall safe "hs_bindgen_test_array_75d83252a55a5c64" hs_bindgen_te __C declaration:__ @fun_14@ -__defined at:__ @array.h:135:9@ +__defined at:__ @array.h:141:9@ __exported by:__ @array.h@ -} @@ -1064,7 +1185,7 @@ fun_14_ptr :: FunPtr (IO (Ptr Matrix)) __C declaration:__ @fun_14@ -__defined at:__ @array.h:135:9@ +__defined at:__ @array.h:141:9@ __exported by:__ @array.h@ -} @@ -1076,7 +1197,7 @@ foreign import ccall safe "hs_bindgen_test_array_069ac2d1873f3210" hs_bindgen_te __C declaration:__ @fun_15@ -__defined at:__ @array.h:138:7@ +__defined at:__ @array.h:144:7@ __exported by:__ @array.h@ -} @@ -1086,7 +1207,7 @@ fun_15_ptr :: FunPtr (IO (Ptr (IncompleteArray (ConstantArray 3 __C declaration:__ @fun_15@ -__defined at:__ @array.h:138:7@ +__defined at:__ @array.h:144:7@ __exported by:__ @array.h@ -} @@ -1097,7 +1218,7 @@ foreign import ccall safe "hs_bindgen_test_array_314971335aaa6db3" hs_bindgen_te __C declaration:__ @fun_16@ -__defined at:__ @array.h:141:14@ +__defined at:__ @array.h:147:14@ __exported by:__ @array.h@ -} @@ -1106,11 +1227,31 @@ fun_16_ptr :: FunPtr (IO (Ptr Tripletlist)) __C declaration:__ @fun_16@ -__defined at:__ @array.h:141:14@ +__defined at:__ @array.h:147:14@ __exported by:__ @array.h@ -} fun_16_ptr = unsafePerformIO hs_bindgen_test_array_314971335aaa6db3 +foreign import ccall safe "hs_bindgen_test_array_9a62b5848be64bd4" hs_bindgen_test_array_9a62b5848be64bd4 :: IO (FunPtr (IO (Ptr Sudoku))) +{-# NOINLINE solve_ptr #-} +{-| Typedef-in-typedef + +__C declaration:__ @solve@ + +__defined at:__ @array.h:150:10@ + +__exported by:__ @array.h@ +-} +solve_ptr :: FunPtr (IO (Ptr Sudoku)) +{-| Typedef-in-typedef + +__C declaration:__ @solve@ + +__defined at:__ @array.h:150:10@ + +__exported by:__ @array.h@ +-} +solve_ptr = unsafePerformIO hs_bindgen_test_array_9a62b5848be64bd4 foreign import ccall safe "hs_bindgen_test_array_a6413f4d2092265d" hs_bindgen_test_array_a6413f4d2092265d :: IO (Ptr (ConstantArray 3 CInt)) {-# NOINLINE arr0_ptr #-} @@ -1243,7 +1384,7 @@ foreign import ccall safe "hs_bindgen_test_array_85bc33b188037456" hs_bindgen_te __C declaration:__ @arr_1@ -__defined at:__ @array.h:59:12@ +__defined at:__ @array.h:62:12@ __exported by:__ @array.h@ -} @@ -1252,7 +1393,7 @@ arr_1_ptr :: Ptr (ConstantArray 3 CInt) __C declaration:__ @arr_1@ -__defined at:__ @array.h:59:12@ +__defined at:__ @array.h:62:12@ __exported by:__ @array.h@ -} @@ -1263,7 +1404,7 @@ foreign import ccall safe "hs_bindgen_test_array_87c784150cd3ff65" hs_bindgen_te __C declaration:__ @arr_2@ -__defined at:__ @array.h:62:16@ +__defined at:__ @array.h:65:16@ __exported by:__ @array.h@ -} @@ -1272,7 +1413,7 @@ arr_2_ptr :: Ptr Triplet __C declaration:__ @arr_2@ -__defined at:__ @array.h:62:16@ +__defined at:__ @array.h:65:16@ __exported by:__ @array.h@ -} @@ -1283,7 +1424,7 @@ foreign import ccall safe "hs_bindgen_test_array_e7b0de7633a7a62a" hs_bindgen_te __C declaration:__ @arr_3@ -__defined at:__ @array.h:65:12@ +__defined at:__ @array.h:68:12@ __exported by:__ @array.h@ -} @@ -1292,7 +1433,7 @@ arr_3_ptr :: Ptr (IncompleteArray CInt) __C declaration:__ @arr_3@ -__defined at:__ @array.h:65:12@ +__defined at:__ @array.h:68:12@ __exported by:__ @array.h@ -} @@ -1303,7 +1444,7 @@ foreign import ccall safe "hs_bindgen_test_array_8fb64bc6c2bd4c73" hs_bindgen_te __C declaration:__ @arr_4@ -__defined at:__ @array.h:68:13@ +__defined at:__ @array.h:71:13@ __exported by:__ @array.h@ -} @@ -1312,7 +1453,7 @@ arr_4_ptr :: Ptr List __C declaration:__ @arr_4@ -__defined at:__ @array.h:68:13@ +__defined at:__ @array.h:71:13@ __exported by:__ @array.h@ -} @@ -1325,7 +1466,7 @@ foreign import ccall safe "hs_bindgen_test_array_7348a94e6adce96e" hs_bindgen_te __C declaration:__ @arr_5@ -__defined at:__ @array.h:71:12@ +__defined at:__ @array.h:74:12@ __exported by:__ @array.h@ -} @@ -1334,7 +1475,7 @@ arr_5_ptr :: Ptr (ConstantArray 4 (ConstantArray 3 CInt)) __C declaration:__ @arr_5@ -__defined at:__ @array.h:71:12@ +__defined at:__ @array.h:74:12@ __exported by:__ @array.h@ -} @@ -1345,7 +1486,7 @@ foreign import ccall safe "hs_bindgen_test_array_1308613140bb4b80" hs_bindgen_te __C declaration:__ @arr_6@ -__defined at:__ @array.h:74:15@ +__defined at:__ @array.h:77:15@ __exported by:__ @array.h@ -} @@ -1354,7 +1495,7 @@ arr_6_ptr :: Ptr Matrix __C declaration:__ @arr_6@ -__defined at:__ @array.h:74:15@ +__defined at:__ @array.h:77:15@ __exported by:__ @array.h@ -} @@ -1366,7 +1507,7 @@ foreign import ccall safe "hs_bindgen_test_array_a060984b378ed676" hs_bindgen_te __C declaration:__ @arr_7@ -__defined at:__ @array.h:77:12@ +__defined at:__ @array.h:80:12@ __exported by:__ @array.h@ -} @@ -1375,7 +1516,7 @@ arr_7_ptr :: Ptr (IncompleteArray (ConstantArray 3 CInt)) __C declaration:__ @arr_7@ -__defined at:__ @array.h:77:12@ +__defined at:__ @array.h:80:12@ __exported by:__ @array.h@ -} @@ -1386,7 +1527,7 @@ foreign import ccall safe "hs_bindgen_test_array_d82706abb6d8ea04" hs_bindgen_te __C declaration:__ @arr_8@ -__defined at:__ @array.h:80:20@ +__defined at:__ @array.h:83:20@ __exported by:__ @array.h@ -} @@ -1395,7 +1536,7 @@ arr_8_ptr :: Ptr Tripletlist __C declaration:__ @arr_8@ -__defined at:__ @array.h:80:20@ +__defined at:__ @array.h:83:20@ __exported by:__ @array.h@ -} diff --git a/hs-bindgen/fixtures/array.tree-diff.txt b/hs-bindgen/fixtures/array.tree-diff.txt index 2a16a801a..589065fd5 100644 --- a/hs-bindgen/fixtures/array.tree-diff.txt +++ b/hs-bindgen/fixtures/array.tree-diff.txt @@ -199,7 +199,7 @@ TranslationUnit { nameHsIdent = Identifier "Triplet"}, declOrigin = NameOriginInSource, - declAliases = [], + declAliases = [Name "sudoku"], declHeaderInfo = Just HeaderInfo { headerMainHeaders = NE.fromList @@ -396,7 +396,51 @@ TranslationUnit { Map.fromList []}}, Decl { declInfo = DeclInfo { - declLoc = "array.h:59:12", + declLoc = "array.h:55:17", + declId = NamePair { + nameC = Name "sudoku", + nameHsIdent = Identifier + "Sudoku"}, + declOrigin = NameOriginInSource, + declAliases = [], + declHeaderInfo = Just + HeaderInfo { + headerMainHeaders = NE.fromList + ["array.h"], + headerInclude = "array.h"}, + declComment = Just + (Comment + [ + Paragraph + [ + TextContent + "Typedef-in-typedef"]])}, + declKind = DeclTypedef + Typedef { + typedefNames = NewtypeNames { + newtypeConstr = Name + "@NsConstr" + "Sudoku", + newtypeField = Name + "@NsVar" + "un_Sudoku"}, + typedefType = TypeConstArray + 3 + (TypeTypedef + (TypedefRegular + NamePair { + nameC = Name "triplet", + nameHsIdent = Identifier + "Triplet"}))}, + declSpec = DeclSpec + CTypeSpec { + cTypeSpecModule = Nothing, + cTypeSpecIdentifier = Nothing, + cTypeSpecInstances = + Map.fromList []}}, + Decl { + declInfo = DeclInfo { + declLoc = "array.h:62:12", declId = NamePair { nameC = Name "arr_1", nameHsIdent = Identifier @@ -428,7 +472,7 @@ TranslationUnit { Map.fromList []}}, Decl { declInfo = DeclInfo { - declLoc = "array.h:62:16", + declLoc = "array.h:65:16", declId = NamePair { nameC = Name "arr_2", nameHsIdent = Identifier @@ -462,7 +506,7 @@ TranslationUnit { Map.fromList []}}, Decl { declInfo = DeclInfo { - declLoc = "array.h:65:12", + declLoc = "array.h:68:12", declId = NamePair { nameC = Name "arr_3", nameHsIdent = Identifier @@ -493,7 +537,7 @@ TranslationUnit { Map.fromList []}}, Decl { declInfo = DeclInfo { - declLoc = "array.h:68:13", + declLoc = "array.h:71:13", declId = NamePair { nameC = Name "arr_4", nameHsIdent = Identifier @@ -527,7 +571,7 @@ TranslationUnit { Map.fromList []}}, Decl { declInfo = DeclInfo { - declLoc = "array.h:71:12", + declLoc = "array.h:74:12", declId = NamePair { nameC = Name "arr_5", nameHsIdent = Identifier @@ -563,7 +607,7 @@ TranslationUnit { Map.fromList []}}, Decl { declInfo = DeclInfo { - declLoc = "array.h:74:15", + declLoc = "array.h:77:15", declId = NamePair { nameC = Name "arr_6", nameHsIdent = Identifier @@ -597,7 +641,7 @@ TranslationUnit { Map.fromList []}}, Decl { declInfo = DeclInfo { - declLoc = "array.h:77:12", + declLoc = "array.h:80:12", declId = NamePair { nameC = Name "arr_7", nameHsIdent = Identifier @@ -632,7 +676,7 @@ TranslationUnit { Map.fromList []}}, Decl { declInfo = DeclInfo { - declLoc = "array.h:80:20", + declLoc = "array.h:83:20", declId = NamePair { nameC = Name "arr_8", nameHsIdent = Identifier @@ -666,7 +710,7 @@ TranslationUnit { Map.fromList []}}, Decl { declInfo = DeclInfo { - declLoc = "array.h:87:5", + declLoc = "array.h:90:5", declId = NamePair { nameC = Name "fun_1", nameHsIdent = Identifier @@ -719,7 +763,7 @@ TranslationUnit { Map.fromList []}}, Decl { declInfo = DeclInfo { - declLoc = "array.h:90:5", + declLoc = "array.h:93:5", declId = NamePair { nameC = Name "fun_2", nameHsIdent = Identifier @@ -765,7 +809,7 @@ TranslationUnit { Map.fromList []}}, Decl { declInfo = DeclInfo { - declLoc = "array.h:93:5", + declLoc = "array.h:96:5", declId = NamePair { nameC = Name "fun_3", nameHsIdent = Identifier @@ -810,7 +854,7 @@ TranslationUnit { Map.fromList []}}, Decl { declInfo = DeclInfo { - declLoc = "array.h:96:5", + declLoc = "array.h:99:5", declId = NamePair { nameC = Name "fun_4", nameHsIdent = Identifier @@ -856,7 +900,7 @@ TranslationUnit { Map.fromList []}}, Decl { declInfo = DeclInfo { - declLoc = "array.h:99:5", + declLoc = "array.h:102:5", declId = NamePair { nameC = Name "fun_5", nameHsIdent = Identifier @@ -904,7 +948,7 @@ TranslationUnit { Map.fromList []}}, Decl { declInfo = DeclInfo { - declLoc = "array.h:102:5", + declLoc = "array.h:105:5", declId = NamePair { nameC = Name "fun_6", nameHsIdent = Identifier @@ -950,7 +994,7 @@ TranslationUnit { Map.fromList []}}, Decl { declInfo = DeclInfo { - declLoc = "array.h:105:5", + declLoc = "array.h:108:5", declId = NamePair { nameC = Name "fun_7", nameHsIdent = Identifier @@ -997,7 +1041,7 @@ TranslationUnit { Map.fromList []}}, Decl { declInfo = DeclInfo { - declLoc = "array.h:108:5", + declLoc = "array.h:111:5", declId = NamePair { nameC = Name "fun_8", nameHsIdent = Identifier @@ -1043,7 +1087,53 @@ TranslationUnit { Map.fromList []}}, Decl { declInfo = DeclInfo { - declLoc = "array.h:120:7", + declLoc = "array.h:114:5", + declId = NamePair { + nameC = Name "isSolved", + nameHsIdent = Identifier + "isSolved"}, + declOrigin = NameOriginInSource, + declAliases = [], + declHeaderInfo = Just + HeaderInfo { + headerMainHeaders = NE.fromList + ["array.h"], + headerInclude = "array.h"}, + declComment = Just + (Comment + [ + Paragraph + [ + TextContent + "Typedef-in-typedef"]])}, + declKind = DeclFunction + Function { + functionArgs = [ + _×_ + (Just + NamePair { + nameC = Name "xss", + nameHsIdent = Identifier "xss"}) + (TypeTypedef + (TypedefRegular + NamePair { + nameC = Name "sudoku", + nameHsIdent = Identifier + "Sudoku"}))], + functionAttrs = + FunctionAttributes + ImpureFunction, + functionRes = TypePrim + (PrimIntegral PrimInt Signed)}, + declSpec = DeclSpec + CTypeSpec { + cTypeSpecModule = Nothing, + cTypeSpecIdentifier = Nothing, + cTypeSpecInstances = + Map.fromList []}}, + Decl { + declInfo = DeclInfo { + declLoc = "array.h:126:7", declId = NamePair { nameC = Name "fun_9", nameHsIdent = Identifier @@ -1083,7 +1173,7 @@ TranslationUnit { Map.fromList []}}, Decl { declInfo = DeclInfo { - declLoc = "array.h:123:10", + declLoc = "array.h:129:10", declId = NamePair { nameC = Name "fun_10", nameHsIdent = Identifier @@ -1123,7 +1213,7 @@ TranslationUnit { Map.fromList []}}, Decl { declInfo = DeclInfo { - declLoc = "array.h:126:7", + declLoc = "array.h:132:7", declId = NamePair { nameC = Name "fun_11", nameHsIdent = Identifier @@ -1162,7 +1252,7 @@ TranslationUnit { Map.fromList []}}, Decl { declInfo = DeclInfo { - declLoc = "array.h:129:7", + declLoc = "array.h:135:7", declId = NamePair { nameC = Name "fun_12", nameHsIdent = Identifier @@ -1202,7 +1292,7 @@ TranslationUnit { Map.fromList []}}, Decl { declInfo = DeclInfo { - declLoc = "array.h:132:7", + declLoc = "array.h:138:7", declId = NamePair { nameC = Name "fun_13", nameHsIdent = Identifier @@ -1244,7 +1334,7 @@ TranslationUnit { Map.fromList []}}, Decl { declInfo = DeclInfo { - declLoc = "array.h:135:9", + declLoc = "array.h:141:9", declId = NamePair { nameC = Name "fun_14", nameHsIdent = Identifier @@ -1284,7 +1374,7 @@ TranslationUnit { Map.fromList []}}, Decl { declInfo = DeclInfo { - declLoc = "array.h:138:7", + declLoc = "array.h:144:7", declId = NamePair { nameC = Name "fun_15", nameHsIdent = Identifier @@ -1325,7 +1415,7 @@ TranslationUnit { Map.fromList []}}, Decl { declInfo = DeclInfo { - declLoc = "array.h:141:14", + declLoc = "array.h:147:14", declId = NamePair { nameC = Name "fun_16", nameHsIdent = Identifier @@ -1357,6 +1447,46 @@ TranslationUnit { nameC = Name "tripletlist", nameHsIdent = Identifier "Tripletlist"}))}, + declSpec = DeclSpec + CTypeSpec { + cTypeSpecModule = Nothing, + cTypeSpecIdentifier = Nothing, + cTypeSpecInstances = + Map.fromList []}}, + Decl { + declInfo = DeclInfo { + declLoc = "array.h:150:10", + declId = NamePair { + nameC = Name "solve", + nameHsIdent = Identifier + "solve"}, + declOrigin = NameOriginInSource, + declAliases = [], + declHeaderInfo = Just + HeaderInfo { + headerMainHeaders = NE.fromList + ["array.h"], + headerInclude = "array.h"}, + declComment = Just + (Comment + [ + Paragraph + [ + TextContent + "Typedef-in-typedef"]])}, + declKind = DeclFunction + Function { + functionArgs = [], + functionAttrs = + FunctionAttributes + ImpureFunction, + functionRes = TypePointer + (TypeTypedef + (TypedefRegular + NamePair { + nameC = Name "sudoku", + nameHsIdent = Identifier + "Sudoku"}))}, declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, From 768950a05c927375fd4d2f89e5ca52f0e3feb4fb Mon Sep 17 00:00:00 2001 From: Joris Dral Date: Thu, 25 Sep 2025 18:25:43 +0200 Subject: [PATCH 2/2] Annotate typedefs with their underlying type This makes typedef erasure a local operation, and now we no longer need a mapping of typedef names to typedef definitions. Moreover, we add type-level tags to the `Type` (representing C types) datatype in the backend. These tags allow us to statically guarantee that some type constructs are omitted from the `Type` datatype. We add simple algorithms to map full C `Type`s to erased (no typedefs) and canonical (no typedefs and const qualifiers) types. These erased/canonical types and their mappings are now used instead of ad-hoc typedef erasure using incomplete information. --- hs-bindgen/fixtures/adios.hs | 3 +- hs-bindgen/fixtures/adios.tree-diff.txt | 3 +- hs-bindgen/fixtures/array.hs | 349 ++++++- hs-bindgen/fixtures/array.tree-diff.txt | 145 ++- hs-bindgen/fixtures/callbacks.hs | 226 ++++- hs-bindgen/fixtures/callbacks.tree-diff.txt | 110 ++- .../fixtures/circular_dependency_fun.hs | 125 ++- .../circular_dependency_fun.tree-diff.txt | 27 +- hs-bindgen/fixtures/distilled_lib_1.hs | 263 ++++- .../fixtures/distilled_lib_1.tree-diff.txt | 251 ++++- hs-bindgen/fixtures/doxygen_docs.hs | 178 +++- .../fixtures/doxygen_docs.tree-diff.txt | 56 +- hs-bindgen/fixtures/fun_attributes.hs | 174 +++- .../fixtures/fun_attributes.tree-diff.txt | 64 +- hs-bindgen/fixtures/globals.hs | 74 +- hs-bindgen/fixtures/globals.tree-diff.txt | 53 +- hs-bindgen/fixtures/hsb_complex_test.hs | 6 +- .../fixtures/hsb_complex_test.tree-diff.txt | 6 +- hs-bindgen/fixtures/iterator.hs | 234 ++++- hs-bindgen/fixtures/iterator.tree-diff.txt | 78 +- hs-bindgen/fixtures/macro_in_fundecl.hs | 27 +- .../fixtures/macro_in_fundecl.tree-diff.txt | 9 +- .../fixtures/macro_in_fundecl_vs_typedef.hs | 107 +- .../macro_in_fundecl_vs_typedef.tree-diff.txt | 36 +- hs-bindgen/fixtures/macro_typedef_scope.hs | 7 +- .../macro_typedef_scope.tree-diff.txt | 7 +- .../fixtures/manual/function_pointers.hs | 45 +- .../manual/function_pointers.tree-diff.txt | 18 +- hs-bindgen/fixtures/program_slicing_simple.hs | 48 +- .../program_slicing_simple.tree-diff.txt | 6 +- hs-bindgen/fixtures/reparse.hs | 921 +++++++++++++----- hs-bindgen/fixtures/reparse.tree-diff.txt | 396 ++++++-- hs-bindgen/fixtures/spec_examples.hs | 150 ++- .../fixtures/spec_examples.tree-diff.txt | 30 +- hs-bindgen/fixtures/type_qualifiers.hs | 24 +- .../fixtures/type_qualifiers.tree-diff.txt | 18 +- hs-bindgen/fixtures/typedef_analysis.hs | 528 ++++++++-- .../fixtures/typedef_analysis.tree-diff.txt | 66 +- hs-bindgen/fixtures/typedef_vs_macro.hs | 80 +- .../fixtures/typedef_vs_macro.tree-diff.txt | 10 +- hs-bindgen/fixtures/typedefs.hs | 23 +- hs-bindgen/fixtures/typedefs.tree-diff.txt | 23 +- .../HsBindgen/Backend/Hs/Translation.hs | 178 ++-- .../HsBindgen/Frontend/AST/Coerce.hs | 5 +- .../HsBindgen/Frontend/AST/Deps.hs | 2 +- .../HsBindgen/Frontend/AST/External.hs | 179 +++- .../HsBindgen/Frontend/AST/Finalize.hs | 4 +- .../HsBindgen/Frontend/AST/PrettyPrinter.hs | 12 +- .../src-internal/HsBindgen/Frontend/Pass.hs | 5 + .../HsBindgen/Frontend/Pass/HandleMacros.hs | 2 +- .../Frontend/Pass/HandleMacros/IsPass.hs | 13 +- .../HsBindgen/Frontend/Pass/HandleTypedefs.hs | 9 +- .../Frontend/Pass/HandleTypedefs/IsPass.hs | 12 +- .../HsBindgen/Frontend/Pass/MangleNames.hs | 9 +- .../HsBindgen/Frontend/Pass/NameAnon.hs | 12 +- .../Frontend/Pass/NameAnon/IsPass.hs | 2 +- .../HsBindgen/Frontend/Pass/Parse/IsPass.hs | 49 +- .../HsBindgen/Frontend/Pass/Parse/Type.hs | 34 +- .../Frontend/Pass/ResolveBindingSpecs.hs | 8 +- .../Pass/ResolveBindingSpecs/IsPass.hs | 3 +- .../HsBindgen/Frontend/Pass/Select/IsPass.hs | 10 +- .../HsBindgen/Frontend/Pass/Sort/IsPass.hs | 10 +- .../Test/HsBindgen/Orphans/TreeDiff.hs | 1 + 63 files changed, 4550 insertions(+), 1013 deletions(-) diff --git a/hs-bindgen/fixtures/adios.hs b/hs-bindgen/fixtures/adios.hs index 88b889c71..b6281da7c 100644 --- a/hs-bindgen/fixtures/adios.hs +++ b/hs-bindgen/fixtures/adios.hs @@ -763,7 +763,8 @@ "/* get_\978\978\978_ptr */ __attribute__ ((const)) signed int const *hs_bindgen_test_adios_c538a25ba7055dd4 (void) { return &\978\978\978; } ", capiWrapperImport = "adios.h"}, foreignImportOrigin = Global - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt Signed))), foreignImportComment = Nothing, diff --git a/hs-bindgen/fixtures/adios.tree-diff.txt b/hs-bindgen/fixtures/adios.tree-diff.txt index 926d758f2..8bf96d31b 100644 --- a/hs-bindgen/fixtures/adios.tree-diff.txt +++ b/hs-bindgen/fixtures/adios.tree-diff.txt @@ -132,7 +132,8 @@ TranslationUnit { headerInclude = "adios.h"}, declComment = Nothing}, declKind = DeclGlobal - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt Signed))), declSpec = DeclSpec diff --git a/hs-bindgen/fixtures/array.hs b/hs-bindgen/fixtures/array.hs index 2861d8089..d21c5dc1f 100644 --- a/hs-bindgen/fixtures/array.hs +++ b/hs-bindgen/fixtures/array.hs @@ -1094,7 +1094,13 @@ NamePair { nameC = Name "triplet", nameHsIdent = Identifier - "Triplet"}))}, + "Triplet"} + (TypeConstArray + 3 + (TypePrim + (PrimIntegral + PrimInt + Signed)))))}, declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, @@ -1274,7 +1280,13 @@ NamePair { nameC = Name "triplet", nameHsIdent = Identifier - "Triplet"}))], + "Triplet"} + (TypeConstArray + 3 + (TypePrim + (PrimIntegral + PrimInt + Signed)))))], functionAttrs = FunctionAttributes ImpureFunction, @@ -1402,8 +1414,12 @@ (TypedefRegular NamePair { nameC = Name "list", - nameHsIdent = Identifier - "List"}))], + nameHsIdent = Identifier "List"} + (TypeIncompleteArray + (TypePrim + (PrimIntegral + PrimInt + Signed)))))], functionAttrs = FunctionAttributes ImpureFunction, @@ -1539,7 +1555,15 @@ NamePair { nameC = Name "matrix", nameHsIdent = Identifier - "Matrix"}))], + "Matrix"} + (TypeConstArray + 4 + (TypeConstArray + 3 + (TypePrim + (PrimIntegral + PrimInt + Signed))))))], functionAttrs = FunctionAttributes ImpureFunction, @@ -1674,7 +1698,14 @@ NamePair { nameC = Name "tripletlist", nameHsIdent = Identifier - "Tripletlist"}))], + "Tripletlist"} + (TypeIncompleteArray + (TypeConstArray + 3 + (TypePrim + (PrimIntegral + PrimInt + Signed))))))], functionAttrs = FunctionAttributes ImpureFunction, @@ -1742,7 +1773,21 @@ NamePair { nameC = Name "sudoku", nameHsIdent = Identifier - "Sudoku"}))], + "Sudoku"} + (TypeConstArray + 3 + (TypeTypedef + (TypedefRegular + NamePair { + nameC = Name "triplet", + nameHsIdent = Identifier + "Triplet"} + (TypeConstArray + 3 + (TypePrim + (PrimIntegral + PrimInt + Signed))))))))], functionAttrs = FunctionAttributes ImpureFunction, @@ -1849,7 +1894,13 @@ NamePair { nameC = Name "triplet", nameHsIdent = Identifier - "Triplet"}))}, + "Triplet"} + (TypeConstArray + 3 + (TypePrim + (PrimIntegral + PrimInt + Signed)))))}, foreignImportComment = Just Comment { commentTitle = Just @@ -1947,8 +1998,12 @@ (TypedefRegular NamePair { nameC = Name "list", - nameHsIdent = Identifier - "List"}))}, + nameHsIdent = Identifier "List"} + (TypeIncompleteArray + (TypePrim + (PrimIntegral + PrimInt + Signed)))))}, foreignImportComment = Just Comment { commentTitle = Just @@ -2053,7 +2108,15 @@ NamePair { nameC = Name "matrix", nameHsIdent = Identifier - "Matrix"}))}, + "Matrix"} + (TypeConstArray + 4 + (TypeConstArray + 3 + (TypePrim + (PrimIntegral + PrimInt + Signed))))))}, foreignImportComment = Just Comment { commentTitle = Just @@ -2156,7 +2219,14 @@ NamePair { nameC = Name "tripletlist", nameHsIdent = Identifier - "Tripletlist"}))}, + "Tripletlist"} + (TypeIncompleteArray + (TypeConstArray + 3 + (TypePrim + (PrimIntegral + PrimInt + Signed))))))}, foreignImportComment = Just Comment { commentTitle = Just @@ -2207,7 +2277,21 @@ NamePair { nameC = Name "sudoku", nameHsIdent = Identifier - "Sudoku"}))}, + "Sudoku"} + (TypeConstArray + 3 + (TypeTypedef + (TypedefRegular + NamePair { + nameC = Name "triplet", + nameHsIdent = Identifier + "Triplet"} + (TypeConstArray + 3 + (TypePrim + (PrimIntegral + PrimInt + Signed))))))))}, foreignImportComment = Just Comment { commentTitle = Just @@ -2350,7 +2434,13 @@ NamePair { nameC = Name "triplet", nameHsIdent = Identifier - "Triplet"}))], + "Triplet"} + (TypeConstArray + 3 + (TypePrim + (PrimIntegral + PrimInt + Signed)))))], functionAttrs = FunctionAttributes ImpureFunction, @@ -2478,8 +2568,12 @@ (TypedefRegular NamePair { nameC = Name "list", - nameHsIdent = Identifier - "List"}))], + nameHsIdent = Identifier "List"} + (TypeIncompleteArray + (TypePrim + (PrimIntegral + PrimInt + Signed)))))], functionAttrs = FunctionAttributes ImpureFunction, @@ -2615,7 +2709,15 @@ NamePair { nameC = Name "matrix", nameHsIdent = Identifier - "Matrix"}))], + "Matrix"} + (TypeConstArray + 4 + (TypeConstArray + 3 + (TypePrim + (PrimIntegral + PrimInt + Signed))))))], functionAttrs = FunctionAttributes ImpureFunction, @@ -2750,7 +2852,14 @@ NamePair { nameC = Name "tripletlist", nameHsIdent = Identifier - "Tripletlist"}))], + "Tripletlist"} + (TypeIncompleteArray + (TypeConstArray + 3 + (TypePrim + (PrimIntegral + PrimInt + Signed))))))], functionAttrs = FunctionAttributes ImpureFunction, @@ -2818,7 +2927,21 @@ NamePair { nameC = Name "sudoku", nameHsIdent = Identifier - "Sudoku"}))], + "Sudoku"} + (TypeConstArray + 3 + (TypeTypedef + (TypedefRegular + NamePair { + nameC = Name "triplet", + nameHsIdent = Identifier + "Triplet"} + (TypeConstArray + 3 + (TypePrim + (PrimIntegral + PrimInt + Signed))))))))], functionAttrs = FunctionAttributes ImpureFunction, @@ -2925,7 +3048,13 @@ NamePair { nameC = Name "triplet", nameHsIdent = Identifier - "Triplet"}))}, + "Triplet"} + (TypeConstArray + 3 + (TypePrim + (PrimIntegral + PrimInt + Signed)))))}, foreignImportComment = Just Comment { commentTitle = Just @@ -3023,8 +3152,12 @@ (TypedefRegular NamePair { nameC = Name "list", - nameHsIdent = Identifier - "List"}))}, + nameHsIdent = Identifier "List"} + (TypeIncompleteArray + (TypePrim + (PrimIntegral + PrimInt + Signed)))))}, foreignImportComment = Just Comment { commentTitle = Just @@ -3129,7 +3262,15 @@ NamePair { nameC = Name "matrix", nameHsIdent = Identifier - "Matrix"}))}, + "Matrix"} + (TypeConstArray + 4 + (TypeConstArray + 3 + (TypePrim + (PrimIntegral + PrimInt + Signed))))))}, foreignImportComment = Just Comment { commentTitle = Just @@ -3232,7 +3373,14 @@ NamePair { nameC = Name "tripletlist", nameHsIdent = Identifier - "Tripletlist"}))}, + "Tripletlist"} + (TypeIncompleteArray + (TypeConstArray + 3 + (TypePrim + (PrimIntegral + PrimInt + Signed))))))}, foreignImportComment = Just Comment { commentTitle = Just @@ -3283,7 +3431,21 @@ NamePair { nameC = Name "sudoku", nameHsIdent = Identifier - "Sudoku"}))}, + "Sudoku"} + (TypeConstArray + 3 + (TypeTypedef + (TypedefRegular + NamePair { + nameC = Name "triplet", + nameHsIdent = Identifier + "Triplet"} + (TypeConstArray + 3 + (TypePrim + (PrimIntegral + PrimInt + Signed))))))))}, foreignImportComment = Just Comment { commentTitle = Just @@ -3374,7 +3536,13 @@ NamePair { nameC = Name "triplet", nameHsIdent = Identifier - "Triplet"})] + "Triplet"} + (TypeConstArray + 3 + (TypePrim + (PrimIntegral + PrimInt + Signed))))] (TypePrim (PrimIntegral PrimInt Signed))), foreignImportComment = Nothing, @@ -3446,8 +3614,12 @@ (TypedefRegular NamePair { nameC = Name "list", - nameHsIdent = Identifier - "List"})] + nameHsIdent = Identifier "List"} + (TypeIncompleteArray + (TypePrim + (PrimIntegral + PrimInt + Signed))))] (TypePrim (PrimIntegral PrimInt Signed))), foreignImportComment = Nothing, @@ -3526,7 +3698,15 @@ NamePair { nameC = Name "matrix", nameHsIdent = Identifier - "Matrix"})] + "Matrix"} + (TypeConstArray + 4 + (TypeConstArray + 3 + (TypePrim + (PrimIntegral + PrimInt + Signed)))))] (TypePrim (PrimIntegral PrimInt Signed))), foreignImportComment = Nothing, @@ -3605,7 +3785,14 @@ NamePair { nameC = Name "tripletlist", nameHsIdent = Identifier - "Tripletlist"})] + "Tripletlist"} + (TypeIncompleteArray + (TypeConstArray + 3 + (TypePrim + (PrimIntegral + PrimInt + Signed)))))] (TypePrim (PrimIntegral PrimInt Signed))), foreignImportComment = Nothing, @@ -3643,7 +3830,21 @@ NamePair { nameC = Name "sudoku", nameHsIdent = Identifier - "Sudoku"})] + "Sudoku"} + (TypeConstArray + 3 + (TypeTypedef + (TypedefRegular + NamePair { + nameC = Name "triplet", + nameHsIdent = Identifier + "Triplet"} + (TypeConstArray + 3 + (TypePrim + (PrimIntegral + PrimInt + Signed)))))))] (TypePrim (PrimIntegral PrimInt Signed))), foreignImportComment = Nothing, @@ -3720,7 +3921,13 @@ NamePair { nameC = Name "triplet", nameHsIdent = Identifier - "Triplet"})))), + "Triplet"} + (TypeConstArray + 3 + (TypePrim + (PrimIntegral + PrimInt + Signed))))))), foreignImportComment = Nothing, foreignImportSafety = Unsafe}, DeclSimple, @@ -3792,8 +3999,12 @@ (TypedefRegular NamePair { nameC = Name "list", - nameHsIdent = Identifier - "List"})))), + nameHsIdent = Identifier "List"} + (TypeIncompleteArray + (TypePrim + (PrimIntegral + PrimInt + Signed))))))), foreignImportComment = Nothing, foreignImportSafety = Unsafe}, DeclSimple, @@ -3872,7 +4083,15 @@ NamePair { nameC = Name "matrix", nameHsIdent = Identifier - "Matrix"})))), + "Matrix"} + (TypeConstArray + 4 + (TypeConstArray + 3 + (TypePrim + (PrimIntegral + PrimInt + Signed)))))))), foreignImportComment = Nothing, foreignImportSafety = Unsafe}, DeclSimple, @@ -3949,7 +4168,14 @@ NamePair { nameC = Name "tripletlist", nameHsIdent = Identifier - "Tripletlist"})))), + "Tripletlist"} + (TypeIncompleteArray + (TypeConstArray + 3 + (TypePrim + (PrimIntegral + PrimInt + Signed)))))))), foreignImportComment = Nothing, foreignImportSafety = Unsafe}, DeclSimple, @@ -3987,7 +4213,21 @@ NamePair { nameC = Name "sudoku", nameHsIdent = Identifier - "Sudoku"})))), + "Sudoku"} + (TypeConstArray + 3 + (TypeTypedef + (TypedefRegular + NamePair { + nameC = Name "triplet", + nameHsIdent = Identifier + "Triplet"} + (TypeConstArray + 3 + (TypePrim + (PrimIntegral + PrimInt + Signed)))))))))), foreignImportComment = Nothing, foreignImportSafety = Unsafe}, DeclSimple, @@ -4228,7 +4468,13 @@ NamePair { nameC = Name "triplet", nameHsIdent = Identifier - "Triplet"})), + "Triplet"} + (TypeConstArray + 3 + (TypePrim + (PrimIntegral + PrimInt + Signed))))), foreignImportComment = Nothing, foreignImportSafety = Unsafe}, DeclSimple, @@ -4288,8 +4534,12 @@ (TypedefRegular NamePair { nameC = Name "list", - nameHsIdent = Identifier - "List"})), + nameHsIdent = Identifier "List"} + (TypeIncompleteArray + (TypePrim + (PrimIntegral + PrimInt + Signed))))), foreignImportComment = Nothing, foreignImportSafety = Unsafe}, DeclSimple, @@ -4358,7 +4608,15 @@ NamePair { nameC = Name "matrix", nameHsIdent = Identifier - "Matrix"})), + "Matrix"} + (TypeConstArray + 4 + (TypeConstArray + 3 + (TypePrim + (PrimIntegral + PrimInt + Signed)))))), foreignImportComment = Nothing, foreignImportSafety = Unsafe}, DeclSimple, @@ -4425,7 +4683,14 @@ NamePair { nameC = Name "tripletlist", nameHsIdent = Identifier - "Tripletlist"})), + "Tripletlist"} + (TypeIncompleteArray + (TypeConstArray + 3 + (TypePrim + (PrimIntegral + PrimInt + Signed)))))), foreignImportComment = Nothing, foreignImportSafety = Unsafe}, DeclSimple, diff --git a/hs-bindgen/fixtures/array.tree-diff.txt b/hs-bindgen/fixtures/array.tree-diff.txt index 589065fd5..b46704279 100644 --- a/hs-bindgen/fixtures/array.tree-diff.txt +++ b/hs-bindgen/fixtures/array.tree-diff.txt @@ -431,7 +431,13 @@ TranslationUnit { NamePair { nameC = Name "triplet", nameHsIdent = Identifier - "Triplet"}))}, + "Triplet"} + (TypeConstArray + 3 + (TypePrim + (PrimIntegral + PrimInt + Signed)))))}, declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, @@ -497,7 +503,13 @@ TranslationUnit { NamePair { nameC = Name "triplet", nameHsIdent = Identifier - "Triplet"})), + "Triplet"} + (TypeConstArray + 3 + (TypePrim + (PrimIntegral + PrimInt + Signed))))), declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, @@ -561,8 +573,12 @@ TranslationUnit { (TypedefRegular NamePair { nameC = Name "list", - nameHsIdent = Identifier - "List"})), + nameHsIdent = Identifier "List"} + (TypeIncompleteArray + (TypePrim + (PrimIntegral + PrimInt + Signed))))), declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, @@ -632,7 +648,15 @@ TranslationUnit { NamePair { nameC = Name "matrix", nameHsIdent = Identifier - "Matrix"})), + "Matrix"} + (TypeConstArray + 4 + (TypeConstArray + 3 + (TypePrim + (PrimIntegral + PrimInt + Signed)))))), declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, @@ -701,7 +725,14 @@ TranslationUnit { NamePair { nameC = Name "tripletlist", nameHsIdent = Identifier - "Tripletlist"})), + "Tripletlist"} + (TypeIncompleteArray + (TypeConstArray + 3 + (TypePrim + (PrimIntegral + PrimInt + Signed)))))), declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, @@ -795,7 +826,13 @@ TranslationUnit { NamePair { nameC = Name "triplet", nameHsIdent = Identifier - "Triplet"}))], + "Triplet"} + (TypeConstArray + 3 + (TypePrim + (PrimIntegral + PrimInt + Signed)))))], functionAttrs = FunctionAttributes ImpureFunction, @@ -885,8 +922,12 @@ TranslationUnit { (TypedefRegular NamePair { nameC = Name "list", - nameHsIdent = Identifier - "List"}))], + nameHsIdent = Identifier "List"} + (TypeIncompleteArray + (TypePrim + (PrimIntegral + PrimInt + Signed)))))], functionAttrs = FunctionAttributes ImpureFunction, @@ -980,7 +1021,15 @@ TranslationUnit { NamePair { nameC = Name "matrix", nameHsIdent = Identifier - "Matrix"}))], + "Matrix"} + (TypeConstArray + 4 + (TypeConstArray + 3 + (TypePrim + (PrimIntegral + PrimInt + Signed))))))], functionAttrs = FunctionAttributes ImpureFunction, @@ -1073,7 +1122,14 @@ TranslationUnit { NamePair { nameC = Name "tripletlist", nameHsIdent = Identifier - "Tripletlist"}))], + "Tripletlist"} + (TypeIncompleteArray + (TypeConstArray + 3 + (TypePrim + (PrimIntegral + PrimInt + Signed))))))], functionAttrs = FunctionAttributes ImpureFunction, @@ -1119,7 +1175,21 @@ TranslationUnit { NamePair { nameC = Name "sudoku", nameHsIdent = Identifier - "Sudoku"}))], + "Sudoku"} + (TypeConstArray + 3 + (TypeTypedef + (TypedefRegular + NamePair { + nameC = Name "triplet", + nameHsIdent = Identifier + "Triplet"} + (TypeConstArray + 3 + (TypePrim + (PrimIntegral + PrimInt + Signed))))))))], functionAttrs = FunctionAttributes ImpureFunction, @@ -1204,7 +1274,13 @@ TranslationUnit { NamePair { nameC = Name "triplet", nameHsIdent = Identifier - "Triplet"}))}, + "Triplet"} + (TypeConstArray + 3 + (TypePrim + (PrimIntegral + PrimInt + Signed)))))}, declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, @@ -1282,8 +1358,12 @@ TranslationUnit { (TypedefRegular NamePair { nameC = Name "list", - nameHsIdent = Identifier - "List"}))}, + nameHsIdent = Identifier "List"} + (TypeIncompleteArray + (TypePrim + (PrimIntegral + PrimInt + Signed)))))}, declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, @@ -1365,7 +1445,15 @@ TranslationUnit { NamePair { nameC = Name "matrix", nameHsIdent = Identifier - "Matrix"}))}, + "Matrix"} + (TypeConstArray + 4 + (TypeConstArray + 3 + (TypePrim + (PrimIntegral + PrimInt + Signed))))))}, declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, @@ -1446,7 +1534,14 @@ TranslationUnit { NamePair { nameC = Name "tripletlist", nameHsIdent = Identifier - "Tripletlist"}))}, + "Tripletlist"} + (TypeIncompleteArray + (TypeConstArray + 3 + (TypePrim + (PrimIntegral + PrimInt + Signed))))))}, declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, @@ -1486,7 +1581,21 @@ TranslationUnit { NamePair { nameC = Name "sudoku", nameHsIdent = Identifier - "Sudoku"}))}, + "Sudoku"} + (TypeConstArray + 3 + (TypeTypedef + (TypedefRegular + NamePair { + nameC = Name "triplet", + nameHsIdent = Identifier + "Triplet"} + (TypeConstArray + 3 + (TypePrim + (PrimIntegral + PrimInt + Signed))))))))}, declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, diff --git a/hs-bindgen/fixtures/callbacks.hs b/hs-bindgen/fixtures/callbacks.hs index f449ccf63..33bb5f0e5 100644 --- a/hs-bindgen/fixtures/callbacks.hs +++ b/hs-bindgen/fixtures/callbacks.hs @@ -221,7 +221,8 @@ nameC = Name "FileOpenedNotification_Deref", nameHsIdent = Identifier - "FileOpenedNotification_Deref"}))}, + "FileOpenedNotification_Deref"} + (TypeFun [] TypeVoid)))}, declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, @@ -513,7 +514,12 @@ nameC = Name "ProgressUpdate_Deref", nameHsIdent = Identifier - "ProgressUpdate_Deref"}))}, + "ProgressUpdate_Deref"} + (TypeFun + [ + TypePrim + (PrimIntegral PrimInt Signed)] + TypeVoid)))}, declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, @@ -808,7 +814,15 @@ nameC = Name "DataValidator_Deref", nameHsIdent = Identifier - "DataValidator_Deref"}))}, + "DataValidator_Deref"} + (TypeFun + [ + TypePrim + (PrimIntegral PrimInt Signed)] + (TypePrim + (PrimIntegral + PrimInt + Signed)))))}, declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, @@ -1741,7 +1755,17 @@ nameC = Name "MeasurementReceived_Deref", nameHsIdent = Identifier - "MeasurementReceived_Deref"}))}, + "MeasurementReceived_Deref"} + (TypeFun + [ + TypePointer + (TypeStruct + NamePair { + nameC = Name "Measurement", + nameHsIdent = Identifier + "Measurement"} + NameOriginInSource)] + TypeVoid)))}, declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, @@ -1947,7 +1971,16 @@ nameC = Name "MeasurementReceived2_Deref", nameHsIdent = Identifier - "MeasurementReceived2_Deref"}))}, + "MeasurementReceived2_Deref"} + (TypeFun + [ + TypeStruct + NamePair { + nameC = Name "Measurement", + nameHsIdent = Identifier + "Measurement"} + NameOriginInSource] + TypeVoid)))}, declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, @@ -2147,7 +2180,14 @@ nameC = Name "SampleBufferFull_Deref", nameHsIdent = Identifier - "SampleBufferFull_Deref"}))}, + "SampleBufferFull_Deref"} + (TypeFun + [ + TypeConstArray + 10 + (TypePrim + (PrimIntegral PrimInt Signed))] + TypeVoid)))}, declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, @@ -2429,7 +2469,9 @@ nameC = Name "FileOpenedNotification", nameHsIdent = Identifier - "FileOpenedNotification"}))], + "FileOpenedNotification"} + (TypePointer + (TypeFun [] TypeVoid))))], functionAttrs = FunctionAttributes ImpureFunction, @@ -2494,7 +2536,13 @@ NamePair { nameC = Name "ProgressUpdate", nameHsIdent = Identifier - "ProgressUpdate"}))], + "ProgressUpdate"} + (TypePointer + (TypeFun + [ + TypePrim + (PrimIntegral PrimInt Signed)] + TypeVoid))))], functionAttrs = FunctionAttributes ImpureFunction, @@ -2572,7 +2620,16 @@ NamePair { nameC = Name "DataValidator", nameHsIdent = Identifier - "DataValidator"})), + "DataValidator"} + (TypePointer + (TypeFun + [ + TypePrim + (PrimIntegral PrimInt Signed)] + (TypePrim + (PrimIntegral + PrimInt + Signed)))))), _×_ (Just NamePair { @@ -2647,7 +2704,18 @@ nameC = Name "MeasurementReceived", nameHsIdent = Identifier - "MeasurementReceived"}))], + "MeasurementReceived"} + (TypePointer + (TypeFun + [ + TypePointer + (TypeStruct + NamePair { + nameC = Name "Measurement", + nameHsIdent = Identifier + "Measurement"} + NameOriginInSource)] + TypeVoid))))], functionAttrs = FunctionAttributes ImpureFunction, @@ -2713,7 +2781,17 @@ nameC = Name "MeasurementReceived2", nameHsIdent = Identifier - "MeasurementReceived2"}))], + "MeasurementReceived2"} + (TypePointer + (TypeFun + [ + TypeStruct + NamePair { + nameC = Name "Measurement", + nameHsIdent = Identifier + "Measurement"} + NameOriginInSource] + TypeVoid))))], functionAttrs = FunctionAttributes ImpureFunction, @@ -2778,7 +2856,15 @@ NamePair { nameC = Name "SampleBufferFull", nameHsIdent = Identifier - "SampleBufferFull"}))], + "SampleBufferFull"} + (TypePointer + (TypeFun + [ + TypeConstArray + 10 + (TypePrim + (PrimIntegral PrimInt Signed))] + TypeVoid))))], functionAttrs = FunctionAttributes ImpureFunction, @@ -3017,7 +3103,9 @@ nameC = Name "FileOpenedNotification", nameHsIdent = Identifier - "FileOpenedNotification"}))], + "FileOpenedNotification"} + (TypePointer + (TypeFun [] TypeVoid))))], functionAttrs = FunctionAttributes ImpureFunction, @@ -3082,7 +3170,13 @@ NamePair { nameC = Name "ProgressUpdate", nameHsIdent = Identifier - "ProgressUpdate"}))], + "ProgressUpdate"} + (TypePointer + (TypeFun + [ + TypePrim + (PrimIntegral PrimInt Signed)] + TypeVoid))))], functionAttrs = FunctionAttributes ImpureFunction, @@ -3160,7 +3254,16 @@ NamePair { nameC = Name "DataValidator", nameHsIdent = Identifier - "DataValidator"})), + "DataValidator"} + (TypePointer + (TypeFun + [ + TypePrim + (PrimIntegral PrimInt Signed)] + (TypePrim + (PrimIntegral + PrimInt + Signed)))))), _×_ (Just NamePair { @@ -3235,7 +3338,18 @@ nameC = Name "MeasurementReceived", nameHsIdent = Identifier - "MeasurementReceived"}))], + "MeasurementReceived"} + (TypePointer + (TypeFun + [ + TypePointer + (TypeStruct + NamePair { + nameC = Name "Measurement", + nameHsIdent = Identifier + "Measurement"} + NameOriginInSource)] + TypeVoid))))], functionAttrs = FunctionAttributes ImpureFunction, @@ -3301,7 +3415,17 @@ nameC = Name "MeasurementReceived2", nameHsIdent = Identifier - "MeasurementReceived2"}))], + "MeasurementReceived2"} + (TypePointer + (TypeFun + [ + TypeStruct + NamePair { + nameC = Name "Measurement", + nameHsIdent = Identifier + "Measurement"} + NameOriginInSource] + TypeVoid))))], functionAttrs = FunctionAttributes ImpureFunction, @@ -3366,7 +3490,15 @@ NamePair { nameC = Name "SampleBufferFull", nameHsIdent = Identifier - "SampleBufferFull"}))], + "SampleBufferFull"} + (TypePointer + (TypeFun + [ + TypeConstArray + 10 + (TypePrim + (PrimIntegral PrimInt Signed))] + TypeVoid))))], functionAttrs = FunctionAttributes ImpureFunction, @@ -3509,7 +3641,9 @@ nameC = Name "FileOpenedNotification", nameHsIdent = Identifier - "FileOpenedNotification"})] + "FileOpenedNotification"} + (TypePointer + (TypeFun [] TypeVoid)))] TypeVoid), foreignImportComment = Nothing, foreignImportSafety = Unsafe}, @@ -3549,7 +3683,13 @@ NamePair { nameC = Name "ProgressUpdate", nameHsIdent = Identifier - "ProgressUpdate"})] + "ProgressUpdate"} + (TypePointer + (TypeFun + [ + TypePrim + (PrimIntegral PrimInt Signed)] + TypeVoid)))] TypeVoid), foreignImportComment = Nothing, foreignImportSafety = Unsafe}, @@ -3591,7 +3731,16 @@ NamePair { nameC = Name "DataValidator", nameHsIdent = Identifier - "DataValidator"}), + "DataValidator"} + (TypePointer + (TypeFun + [ + TypePrim + (PrimIntegral PrimInt Signed)] + (TypePrim + (PrimIntegral + PrimInt + Signed))))), TypePrim (PrimIntegral PrimInt Signed)] (TypePrim @@ -3635,7 +3784,18 @@ nameC = Name "MeasurementReceived", nameHsIdent = Identifier - "MeasurementReceived"})] + "MeasurementReceived"} + (TypePointer + (TypeFun + [ + TypePointer + (TypeStruct + NamePair { + nameC = Name "Measurement", + nameHsIdent = Identifier + "Measurement"} + NameOriginInSource)] + TypeVoid)))] TypeVoid), foreignImportComment = Nothing, foreignImportSafety = Unsafe}, @@ -3676,7 +3836,17 @@ nameC = Name "MeasurementReceived2", nameHsIdent = Identifier - "MeasurementReceived2"})] + "MeasurementReceived2"} + (TypePointer + (TypeFun + [ + TypeStruct + NamePair { + nameC = Name "Measurement", + nameHsIdent = Identifier + "Measurement"} + NameOriginInSource] + TypeVoid)))] TypeVoid), foreignImportComment = Nothing, foreignImportSafety = Unsafe}, @@ -3716,7 +3886,15 @@ NamePair { nameC = Name "SampleBufferFull", nameHsIdent = Identifier - "SampleBufferFull"})] + "SampleBufferFull"} + (TypePointer + (TypeFun + [ + TypeConstArray + 10 + (TypePrim + (PrimIntegral PrimInt Signed))] + TypeVoid)))] TypeVoid), foreignImportComment = Nothing, foreignImportSafety = Unsafe}, diff --git a/hs-bindgen/fixtures/callbacks.tree-diff.txt b/hs-bindgen/fixtures/callbacks.tree-diff.txt index 4773dadda..b2f8ac942 100644 --- a/hs-bindgen/fixtures/callbacks.tree-diff.txt +++ b/hs-bindgen/fixtures/callbacks.tree-diff.txt @@ -178,7 +178,8 @@ TranslationUnit { nameC = Name "FileOpenedNotification_Deref", nameHsIdent = Identifier - "FileOpenedNotification_Deref"}))}, + "FileOpenedNotification_Deref"} + (TypeFun [] TypeVoid)))}, declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, @@ -265,7 +266,12 @@ TranslationUnit { nameC = Name "ProgressUpdate_Deref", nameHsIdent = Identifier - "ProgressUpdate_Deref"}))}, + "ProgressUpdate_Deref"} + (TypeFun + [ + TypePrim + (PrimIntegral PrimInt Signed)] + TypeVoid)))}, declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, @@ -353,7 +359,15 @@ TranslationUnit { nameC = Name "DataValidator_Deref", nameHsIdent = Identifier - "DataValidator_Deref"}))}, + "DataValidator_Deref"} + (TypeFun + [ + TypePrim + (PrimIntegral PrimInt Signed)] + (TypePrim + (PrimIntegral + PrimInt + Signed)))))}, declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, @@ -390,7 +404,9 @@ TranslationUnit { nameC = Name "FileOpenedNotification", nameHsIdent = Identifier - "FileOpenedNotification"}))], + "FileOpenedNotification"} + (TypePointer + (TypeFun [] TypeVoid))))], functionAttrs = FunctionAttributes ImpureFunction, @@ -431,7 +447,13 @@ TranslationUnit { NamePair { nameC = Name "ProgressUpdate", nameHsIdent = Identifier - "ProgressUpdate"}))], + "ProgressUpdate"} + (TypePointer + (TypeFun + [ + TypePrim + (PrimIntegral PrimInt Signed)] + TypeVoid))))], functionAttrs = FunctionAttributes ImpureFunction, @@ -471,7 +493,16 @@ TranslationUnit { NamePair { nameC = Name "DataValidator", nameHsIdent = Identifier - "DataValidator"})), + "DataValidator"} + (TypePointer + (TypeFun + [ + TypePrim + (PrimIntegral PrimInt Signed)] + (TypePrim + (PrimIntegral + PrimInt + Signed)))))), _×_ (Just NamePair { @@ -633,7 +664,17 @@ TranslationUnit { nameC = Name "MeasurementReceived_Deref", nameHsIdent = Identifier - "MeasurementReceived_Deref"}))}, + "MeasurementReceived_Deref"} + (TypeFun + [ + TypePointer + (TypeStruct + NamePair { + nameC = Name "Measurement", + nameHsIdent = Identifier + "Measurement"} + NameOriginInSource)] + TypeVoid)))}, declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, @@ -670,7 +711,18 @@ TranslationUnit { nameC = Name "MeasurementReceived", nameHsIdent = Identifier - "MeasurementReceived"}))], + "MeasurementReceived"} + (TypePointer + (TypeFun + [ + TypePointer + (TypeStruct + NamePair { + nameC = Name "Measurement", + nameHsIdent = Identifier + "Measurement"} + NameOriginInSource)] + TypeVoid))))], functionAttrs = FunctionAttributes ImpureFunction, @@ -767,7 +819,16 @@ TranslationUnit { nameC = Name "MeasurementReceived2_Deref", nameHsIdent = Identifier - "MeasurementReceived2_Deref"}))}, + "MeasurementReceived2_Deref"} + (TypeFun + [ + TypeStruct + NamePair { + nameC = Name "Measurement", + nameHsIdent = Identifier + "Measurement"} + NameOriginInSource] + TypeVoid)))}, declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, @@ -805,7 +866,17 @@ TranslationUnit { nameC = Name "MeasurementReceived2", nameHsIdent = Identifier - "MeasurementReceived2"}))], + "MeasurementReceived2"} + (TypePointer + (TypeFun + [ + TypeStruct + NamePair { + nameC = Name "Measurement", + nameHsIdent = Identifier + "Measurement"} + NameOriginInSource] + TypeVoid))))], functionAttrs = FunctionAttributes ImpureFunction, @@ -898,7 +969,14 @@ TranslationUnit { nameC = Name "SampleBufferFull_Deref", nameHsIdent = Identifier - "SampleBufferFull_Deref"}))}, + "SampleBufferFull_Deref"} + (TypeFun + [ + TypeConstArray + 10 + (TypePrim + (PrimIntegral PrimInt Signed))] + TypeVoid)))}, declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, @@ -934,7 +1012,15 @@ TranslationUnit { NamePair { nameC = Name "SampleBufferFull", nameHsIdent = Identifier - "SampleBufferFull"}))], + "SampleBufferFull"} + (TypePointer + (TypeFun + [ + TypeConstArray + 10 + (TypePrim + (PrimIntegral PrimInt Signed))] + TypeVoid))))], functionAttrs = FunctionAttributes ImpureFunction, diff --git a/hs-bindgen/fixtures/circular_dependency_fun.hs b/hs-bindgen/fixtures/circular_dependency_fun.hs index ef99dc69a..15f4be24d 100644 --- a/hs-bindgen/fixtures/circular_dependency_fun.hs +++ b/hs-bindgen/fixtures/circular_dependency_fun.hs @@ -255,7 +255,18 @@ NamePair { nameC = Name "fun_ptr_Deref", nameHsIdent = Identifier - "Fun_ptr_Deref"}))}, + "Fun_ptr_Deref"} + (TypeFun + [ + TypePointer + (TypeStruct + NamePair { + nameC = Name + "forward_declaration", + nameHsIdent = Identifier + "Forward_declaration"} + NameOriginInSource)] + TypeVoid)))}, declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, @@ -349,7 +360,19 @@ NamePair { nameC = Name "fun_ptr", nameHsIdent = Identifier - "Fun_ptr"}), + "Fun_ptr"} + (TypePointer + (TypeFun + [ + TypePointer + (TypeStruct + NamePair { + nameC = Name + "forward_declaration", + nameHsIdent = Identifier + "Forward_declaration"} + NameOriginInSource)] + TypeVoid))), structFieldOffset = 0, structFieldWidth = Nothing}, fieldComment = Just @@ -407,7 +430,19 @@ NamePair { nameC = Name "fun_ptr", nameHsIdent = Identifier - "Fun_ptr"}), + "Fun_ptr"} + (TypePointer + (TypeFun + [ + TypePointer + (TypeStruct + NamePair { + nameC = Name + "forward_declaration", + nameHsIdent = Identifier + "Forward_declaration"} + NameOriginInSource)] + TypeVoid))), structFieldOffset = 0, structFieldWidth = Nothing}], structFlam = Nothing}, @@ -468,7 +503,19 @@ NamePair { nameC = Name "fun_ptr", nameHsIdent = Identifier - "Fun_ptr"}), + "Fun_ptr"} + (TypePointer + (TypeFun + [ + TypePointer + (TypeStruct + NamePair { + nameC = Name + "forward_declaration", + nameHsIdent = Identifier + "Forward_declaration"} + NameOriginInSource)] + TypeVoid))), structFieldOffset = 0, structFieldWidth = Nothing}, fieldComment = Just @@ -526,7 +573,19 @@ NamePair { nameC = Name "fun_ptr", nameHsIdent = Identifier - "Fun_ptr"}), + "Fun_ptr"} + (TypePointer + (TypeFun + [ + TypePointer + (TypeStruct + NamePair { + nameC = Name + "forward_declaration", + nameHsIdent = Identifier + "Forward_declaration"} + NameOriginInSource)] + TypeVoid))), structFieldOffset = 0, structFieldWidth = Nothing}], structFlam = Nothing}, @@ -590,7 +649,19 @@ NamePair { nameC = Name "fun_ptr", nameHsIdent = Identifier - "Fun_ptr"}), + "Fun_ptr"} + (TypePointer + (TypeFun + [ + TypePointer + (TypeStruct + NamePair { + nameC = Name + "forward_declaration", + nameHsIdent = Identifier + "Forward_declaration"} + NameOriginInSource)] + TypeVoid))), structFieldOffset = 0, structFieldWidth = Nothing}, fieldComment = Just @@ -648,7 +719,19 @@ NamePair { nameC = Name "fun_ptr", nameHsIdent = Identifier - "Fun_ptr"}), + "Fun_ptr"} + (TypePointer + (TypeFun + [ + TypePointer + (TypeStruct + NamePair { + nameC = Name + "forward_declaration", + nameHsIdent = Identifier + "Forward_declaration"} + NameOriginInSource)] + TypeVoid))), structFieldOffset = 0, structFieldWidth = Nothing}], structFlam = Nothing}, @@ -712,7 +795,19 @@ NamePair { nameC = Name "fun_ptr", nameHsIdent = Identifier - "Fun_ptr"}), + "Fun_ptr"} + (TypePointer + (TypeFun + [ + TypePointer + (TypeStruct + NamePair { + nameC = Name + "forward_declaration", + nameHsIdent = Identifier + "Forward_declaration"} + NameOriginInSource)] + TypeVoid))), structFieldOffset = 0, structFieldWidth = Nothing}, fieldComment = Just @@ -770,7 +865,19 @@ NamePair { nameC = Name "fun_ptr", nameHsIdent = Identifier - "Fun_ptr"}), + "Fun_ptr"} + (TypePointer + (TypeFun + [ + TypePointer + (TypeStruct + NamePair { + nameC = Name + "forward_declaration", + nameHsIdent = Identifier + "Forward_declaration"} + NameOriginInSource)] + TypeVoid))), structFieldOffset = 0, structFieldWidth = Nothing}], structFlam = Nothing}, diff --git a/hs-bindgen/fixtures/circular_dependency_fun.tree-diff.txt b/hs-bindgen/fixtures/circular_dependency_fun.tree-diff.txt index 0cc32f533..b9af94628 100644 --- a/hs-bindgen/fixtures/circular_dependency_fun.tree-diff.txt +++ b/hs-bindgen/fixtures/circular_dependency_fun.tree-diff.txt @@ -89,7 +89,18 @@ TranslationUnit { NamePair { nameC = Name "fun_ptr_Deref", nameHsIdent = Identifier - "Fun_ptr_Deref"}))}, + "Fun_ptr_Deref"} + (TypeFun + [ + TypePointer + (TypeStruct + NamePair { + nameC = Name + "forward_declaration", + nameHsIdent = Identifier + "Forward_declaration"} + NameOriginInSource)] + TypeVoid)))}, declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, @@ -137,7 +148,19 @@ TranslationUnit { NamePair { nameC = Name "fun_ptr", nameHsIdent = Identifier - "Fun_ptr"}), + "Fun_ptr"} + (TypePointer + (TypeFun + [ + TypePointer + (TypeStruct + NamePair { + nameC = Name + "forward_declaration", + nameHsIdent = Identifier + "Forward_declaration"} + NameOriginInSource)] + TypeVoid))), structFieldOffset = 0, structFieldWidth = Nothing}], structFlam = Nothing}, diff --git a/hs-bindgen/fixtures/distilled_lib_1.hs b/hs-bindgen/fixtures/distilled_lib_1.hs index 028ab5b43..cb3caf528 100644 --- a/hs-bindgen/fixtures/distilled_lib_1.hs +++ b/hs-bindgen/fixtures/distilled_lib_1.hs @@ -11760,7 +11760,244 @@ NamePair { nameC = Name "callback_t_Deref", nameHsIdent = Identifier - "Callback_t_Deref"}))}, + "Callback_t_Deref"} + (TypeFun + [ + TypePointer TypeVoid, + TypeExtBinding + ResolvedExtBinding { + extCName = QualName { + qualNameName = Name "uint32_t", + qualNameKind = + NameKindOrdinary}, + extHsRef = ExtRef { + extRefModule = ModuleName + "HsBindgen.Runtime.Prelude", + extRefIdentifier = Identifier + "Word32"}, + extHsSpec = CTypeSpec { + cTypeSpecModule = Just + (ModuleName + "HsBindgen.Runtime.Prelude"), + cTypeSpecIdentifier = Just + (Identifier "Word32"), + cTypeSpecInstances = + Map.fromList + [ + _×_ + Bits + (Require + InstanceSpec { + instanceSpecStrategy = Nothing, + instanceSpecConstraints = []}), + _×_ + Bounded + (Require + InstanceSpec { + instanceSpecStrategy = Nothing, + instanceSpecConstraints = []}), + _×_ + Enum + (Require + InstanceSpec { + instanceSpecStrategy = Nothing, + instanceSpecConstraints = []}), + _×_ + Eq + (Require + InstanceSpec { + instanceSpecStrategy = Nothing, + instanceSpecConstraints = []}), + _×_ + FiniteBits + (Require + InstanceSpec { + instanceSpecStrategy = Nothing, + instanceSpecConstraints = []}), + _×_ + Integral + (Require + InstanceSpec { + instanceSpecStrategy = Nothing, + instanceSpecConstraints = []}), + _×_ + Ix + (Require + InstanceSpec { + instanceSpecStrategy = Nothing, + instanceSpecConstraints = []}), + _×_ + Num + (Require + InstanceSpec { + instanceSpecStrategy = Nothing, + instanceSpecConstraints = []}), + _×_ + Ord + (Require + InstanceSpec { + instanceSpecStrategy = Nothing, + instanceSpecConstraints = []}), + _×_ + Read + (Require + InstanceSpec { + instanceSpecStrategy = Nothing, + instanceSpecConstraints = []}), + _×_ + ReadRaw + (Require + InstanceSpec { + instanceSpecStrategy = Nothing, + instanceSpecConstraints = []}), + _×_ + Real + (Require + InstanceSpec { + instanceSpecStrategy = Nothing, + instanceSpecConstraints = []}), + _×_ + Show + (Require + InstanceSpec { + instanceSpecStrategy = Nothing, + instanceSpecConstraints = []}), + _×_ + StaticSize + (Require + InstanceSpec { + instanceSpecStrategy = Nothing, + instanceSpecConstraints = []}), + _×_ + Storable + (Require + InstanceSpec { + instanceSpecStrategy = Nothing, + instanceSpecConstraints = []}), + _×_ + WriteRaw + (Require + InstanceSpec { + instanceSpecStrategy = Nothing, + instanceSpecConstraints = [ + ]})]}}] + (TypeExtBinding + ResolvedExtBinding { + extCName = QualName { + qualNameName = Name "uint32_t", + qualNameKind = + NameKindOrdinary}, + extHsRef = ExtRef { + extRefModule = ModuleName + "HsBindgen.Runtime.Prelude", + extRefIdentifier = Identifier + "Word32"}, + extHsSpec = CTypeSpec { + cTypeSpecModule = Just + (ModuleName + "HsBindgen.Runtime.Prelude"), + cTypeSpecIdentifier = Just + (Identifier "Word32"), + cTypeSpecInstances = + Map.fromList + [ + _×_ + Bits + (Require + InstanceSpec { + instanceSpecStrategy = Nothing, + instanceSpecConstraints = []}), + _×_ + Bounded + (Require + InstanceSpec { + instanceSpecStrategy = Nothing, + instanceSpecConstraints = []}), + _×_ + Enum + (Require + InstanceSpec { + instanceSpecStrategy = Nothing, + instanceSpecConstraints = []}), + _×_ + Eq + (Require + InstanceSpec { + instanceSpecStrategy = Nothing, + instanceSpecConstraints = []}), + _×_ + FiniteBits + (Require + InstanceSpec { + instanceSpecStrategy = Nothing, + instanceSpecConstraints = []}), + _×_ + Integral + (Require + InstanceSpec { + instanceSpecStrategy = Nothing, + instanceSpecConstraints = []}), + _×_ + Ix + (Require + InstanceSpec { + instanceSpecStrategy = Nothing, + instanceSpecConstraints = []}), + _×_ + Num + (Require + InstanceSpec { + instanceSpecStrategy = Nothing, + instanceSpecConstraints = []}), + _×_ + Ord + (Require + InstanceSpec { + instanceSpecStrategy = Nothing, + instanceSpecConstraints = []}), + _×_ + Read + (Require + InstanceSpec { + instanceSpecStrategy = Nothing, + instanceSpecConstraints = []}), + _×_ + ReadRaw + (Require + InstanceSpec { + instanceSpecStrategy = Nothing, + instanceSpecConstraints = []}), + _×_ + Real + (Require + InstanceSpec { + instanceSpecStrategy = Nothing, + instanceSpecConstraints = []}), + _×_ + Show + (Require + InstanceSpec { + instanceSpecStrategy = Nothing, + instanceSpecConstraints = []}), + _×_ + StaticSize + (Require + InstanceSpec { + instanceSpecStrategy = Nothing, + instanceSpecConstraints = []}), + _×_ + Storable + (Require + InstanceSpec { + instanceSpecStrategy = Nothing, + instanceSpecConstraints = []}), + _×_ + WriteRaw + (Require + InstanceSpec { + instanceSpecStrategy = Nothing, + instanceSpecConstraints = [ + ]})]}}))))}, declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, @@ -12228,7 +12465,11 @@ NamePair { nameC = Name "a_type_t", nameHsIdent = Identifier - "A_type_t"}))), + "A_type_t"} + (TypePrim + (PrimIntegral + PrimInt + Signed))))), _×_ (Just NamePair { @@ -13014,7 +13255,11 @@ NamePair { nameC = Name "a_type_t", nameHsIdent = Identifier - "A_type_t"}))), + "A_type_t"} + (TypePrim + (PrimIntegral + PrimInt + Signed))))), _×_ (Just NamePair { @@ -13769,7 +14014,11 @@ NamePair { nameC = Name "a_type_t", nameHsIdent = Identifier - "A_type_t"})), + "A_type_t"} + (TypePrim + (PrimIntegral + PrimInt + Signed)))), TypeExtBinding ResolvedExtBinding { extCName = QualName { @@ -14155,7 +14404,11 @@ NamePair { nameC = Name "var_t", nameHsIdent = Identifier - "Var_t"})), + "Var_t"} + (TypePrim + (PrimIntegral + PrimInt + Signed)))), foreignImportComment = Nothing, foreignImportSafety = Unsafe}, DeclSimple, diff --git a/hs-bindgen/fixtures/distilled_lib_1.tree-diff.txt b/hs-bindgen/fixtures/distilled_lib_1.tree-diff.txt index ab8c6b076..c43ee20ac 100644 --- a/hs-bindgen/fixtures/distilled_lib_1.tree-diff.txt +++ b/hs-bindgen/fixtures/distilled_lib_1.tree-diff.txt @@ -1262,7 +1262,11 @@ TranslationUnit { NamePair { nameC = Name "a_type_t", nameHsIdent = Identifier - "A_type_t"}))), + "A_type_t"} + (TypePrim + (PrimIntegral + PrimInt + Signed))))), _×_ (Just NamePair { @@ -1949,7 +1953,244 @@ TranslationUnit { NamePair { nameC = Name "callback_t_Deref", nameHsIdent = Identifier - "Callback_t_Deref"}))}, + "Callback_t_Deref"} + (TypeFun + [ + TypePointer TypeVoid, + TypeExtBinding + ResolvedExtBinding { + extCName = QualName { + qualNameName = Name "uint32_t", + qualNameKind = + NameKindOrdinary}, + extHsRef = ExtRef { + extRefModule = ModuleName + "HsBindgen.Runtime.Prelude", + extRefIdentifier = Identifier + "Word32"}, + extHsSpec = CTypeSpec { + cTypeSpecModule = Just + (ModuleName + "HsBindgen.Runtime.Prelude"), + cTypeSpecIdentifier = Just + (Identifier "Word32"), + cTypeSpecInstances = + Map.fromList + [ + _×_ + Bits + (Require + InstanceSpec { + instanceSpecStrategy = Nothing, + instanceSpecConstraints = []}), + _×_ + Bounded + (Require + InstanceSpec { + instanceSpecStrategy = Nothing, + instanceSpecConstraints = []}), + _×_ + Enum + (Require + InstanceSpec { + instanceSpecStrategy = Nothing, + instanceSpecConstraints = []}), + _×_ + Eq + (Require + InstanceSpec { + instanceSpecStrategy = Nothing, + instanceSpecConstraints = []}), + _×_ + FiniteBits + (Require + InstanceSpec { + instanceSpecStrategy = Nothing, + instanceSpecConstraints = []}), + _×_ + Integral + (Require + InstanceSpec { + instanceSpecStrategy = Nothing, + instanceSpecConstraints = []}), + _×_ + Ix + (Require + InstanceSpec { + instanceSpecStrategy = Nothing, + instanceSpecConstraints = []}), + _×_ + Num + (Require + InstanceSpec { + instanceSpecStrategy = Nothing, + instanceSpecConstraints = []}), + _×_ + Ord + (Require + InstanceSpec { + instanceSpecStrategy = Nothing, + instanceSpecConstraints = []}), + _×_ + Read + (Require + InstanceSpec { + instanceSpecStrategy = Nothing, + instanceSpecConstraints = []}), + _×_ + ReadRaw + (Require + InstanceSpec { + instanceSpecStrategy = Nothing, + instanceSpecConstraints = []}), + _×_ + Real + (Require + InstanceSpec { + instanceSpecStrategy = Nothing, + instanceSpecConstraints = []}), + _×_ + Show + (Require + InstanceSpec { + instanceSpecStrategy = Nothing, + instanceSpecConstraints = []}), + _×_ + StaticSize + (Require + InstanceSpec { + instanceSpecStrategy = Nothing, + instanceSpecConstraints = []}), + _×_ + Storable + (Require + InstanceSpec { + instanceSpecStrategy = Nothing, + instanceSpecConstraints = []}), + _×_ + WriteRaw + (Require + InstanceSpec { + instanceSpecStrategy = Nothing, + instanceSpecConstraints = [ + ]})]}}] + (TypeExtBinding + ResolvedExtBinding { + extCName = QualName { + qualNameName = Name "uint32_t", + qualNameKind = + NameKindOrdinary}, + extHsRef = ExtRef { + extRefModule = ModuleName + "HsBindgen.Runtime.Prelude", + extRefIdentifier = Identifier + "Word32"}, + extHsSpec = CTypeSpec { + cTypeSpecModule = Just + (ModuleName + "HsBindgen.Runtime.Prelude"), + cTypeSpecIdentifier = Just + (Identifier "Word32"), + cTypeSpecInstances = + Map.fromList + [ + _×_ + Bits + (Require + InstanceSpec { + instanceSpecStrategy = Nothing, + instanceSpecConstraints = []}), + _×_ + Bounded + (Require + InstanceSpec { + instanceSpecStrategy = Nothing, + instanceSpecConstraints = []}), + _×_ + Enum + (Require + InstanceSpec { + instanceSpecStrategy = Nothing, + instanceSpecConstraints = []}), + _×_ + Eq + (Require + InstanceSpec { + instanceSpecStrategy = Nothing, + instanceSpecConstraints = []}), + _×_ + FiniteBits + (Require + InstanceSpec { + instanceSpecStrategy = Nothing, + instanceSpecConstraints = []}), + _×_ + Integral + (Require + InstanceSpec { + instanceSpecStrategy = Nothing, + instanceSpecConstraints = []}), + _×_ + Ix + (Require + InstanceSpec { + instanceSpecStrategy = Nothing, + instanceSpecConstraints = []}), + _×_ + Num + (Require + InstanceSpec { + instanceSpecStrategy = Nothing, + instanceSpecConstraints = []}), + _×_ + Ord + (Require + InstanceSpec { + instanceSpecStrategy = Nothing, + instanceSpecConstraints = []}), + _×_ + Read + (Require + InstanceSpec { + instanceSpecStrategy = Nothing, + instanceSpecConstraints = []}), + _×_ + ReadRaw + (Require + InstanceSpec { + instanceSpecStrategy = Nothing, + instanceSpecConstraints = []}), + _×_ + Real + (Require + InstanceSpec { + instanceSpecStrategy = Nothing, + instanceSpecConstraints = []}), + _×_ + Show + (Require + InstanceSpec { + instanceSpecStrategy = Nothing, + instanceSpecConstraints = []}), + _×_ + StaticSize + (Require + InstanceSpec { + instanceSpecStrategy = Nothing, + instanceSpecConstraints = []}), + _×_ + Storable + (Require + InstanceSpec { + instanceSpecStrategy = Nothing, + instanceSpecConstraints = []}), + _×_ + WriteRaw + (Require + InstanceSpec { + instanceSpecStrategy = Nothing, + instanceSpecConstraints = [ + ]})]}}))))}, declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, @@ -1978,7 +2219,11 @@ TranslationUnit { NamePair { nameC = Name "var_t", nameHsIdent = Identifier - "Var_t"})), + "Var_t"} + (TypePrim + (PrimIntegral + PrimInt + Signed)))), declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, diff --git a/hs-bindgen/fixtures/doxygen_docs.hs b/hs-bindgen/fixtures/doxygen_docs.hs index eff4c00dd..26509b59d 100644 --- a/hs-bindgen/fixtures/doxygen_docs.hs +++ b/hs-bindgen/fixtures/doxygen_docs.hs @@ -1393,7 +1393,16 @@ nameC = Name "event_callback_t_Deref", nameHsIdent = Identifier - "Event_callback_t_Deref"}))}, + "Event_callback_t_Deref"} + (TypeFun + [ + TypePrim + (PrimIntegral PrimInt Signed), + TypePointer TypeVoid] + (TypePrim + (PrimIntegral + PrimInt + Signed)))))}, declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, @@ -2129,7 +2138,17 @@ NamePair { nameC = Name "event_callback_t", nameHsIdent = Identifier - "Event_callback_t"}), + "Event_callback_t"} + (TypePointer + (TypeFun + [ + TypePrim + (PrimIntegral PrimInt Signed), + TypePointer TypeVoid] + (TypePrim + (PrimIntegral + PrimInt + Signed))))), structFieldOffset = 576, structFieldWidth = Nothing}, fieldComment = Just @@ -2573,7 +2592,17 @@ NamePair { nameC = Name "event_callback_t", nameHsIdent = Identifier - "Event_callback_t"}), + "Event_callback_t"} + (TypePointer + (TypeFun + [ + TypePrim + (PrimIntegral PrimInt Signed), + TypePointer TypeVoid] + (TypePrim + (PrimIntegral + PrimInt + Signed))))), structFieldOffset = 576, structFieldWidth = Nothing}, StructField { @@ -3275,7 +3304,17 @@ NamePair { nameC = Name "event_callback_t", nameHsIdent = Identifier - "Event_callback_t"}), + "Event_callback_t"} + (TypePointer + (TypeFun + [ + TypePrim + (PrimIntegral PrimInt Signed), + TypePointer TypeVoid] + (TypePrim + (PrimIntegral + PrimInt + Signed))))), structFieldOffset = 576, structFieldWidth = Nothing}, fieldComment = Just @@ -3722,7 +3761,17 @@ NamePair { nameC = Name "event_callback_t", nameHsIdent = Identifier - "Event_callback_t"}), + "Event_callback_t"} + (TypePointer + (TypeFun + [ + TypePrim + (PrimIntegral PrimInt Signed), + TypePointer TypeVoid] + (TypePrim + (PrimIntegral + PrimInt + Signed))))), structFieldOffset = 576, structFieldWidth = Nothing}, StructField { @@ -4428,7 +4477,17 @@ NamePair { nameC = Name "event_callback_t", nameHsIdent = Identifier - "Event_callback_t"}), + "Event_callback_t"} + (TypePointer + (TypeFun + [ + TypePrim + (PrimIntegral PrimInt Signed), + TypePointer TypeVoid] + (TypePrim + (PrimIntegral + PrimInt + Signed))))), structFieldOffset = 576, structFieldWidth = Nothing}, fieldComment = Just @@ -4875,7 +4934,17 @@ NamePair { nameC = Name "event_callback_t", nameHsIdent = Identifier - "Event_callback_t"}), + "Event_callback_t"} + (TypePointer + (TypeFun + [ + TypePrim + (PrimIntegral PrimInt Signed), + TypePointer TypeVoid] + (TypePrim + (PrimIntegral + PrimInt + Signed))))), structFieldOffset = 576, structFieldWidth = Nothing}, StructField { @@ -5588,7 +5657,17 @@ NamePair { nameC = Name "event_callback_t", nameHsIdent = Identifier - "Event_callback_t"}), + "Event_callback_t"} + (TypePointer + (TypeFun + [ + TypePrim + (PrimIntegral PrimInt Signed), + TypePointer TypeVoid] + (TypePrim + (PrimIntegral + PrimInt + Signed))))), structFieldOffset = 576, structFieldWidth = Nothing}, fieldComment = Just @@ -6035,7 +6114,17 @@ NamePair { nameC = Name "event_callback_t", nameHsIdent = Identifier - "Event_callback_t"}), + "Event_callback_t"} + (TypePointer + (TypeFun + [ + TypePrim + (PrimIntegral PrimInt Signed), + TypePointer TypeVoid] + (TypePrim + (PrimIntegral + PrimInt + Signed))))), structFieldOffset = 576, structFieldWidth = Nothing}, StructField { @@ -13254,7 +13343,16 @@ nameC = Name "processor_fn_t_Deref", nameHsIdent = Identifier - "Processor_fn_t_Deref"}))}, + "Processor_fn_t_Deref"} + (TypeFun + [ + TypePrim + (PrimIntegral PrimInt Signed), + TypePointer TypeVoid] + (TypePrim + (PrimIntegral + PrimInt + Signed)))))}, declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, @@ -16631,7 +16729,8 @@ nameHsIdent = Identifier "input_data"}) (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypeExtBinding ResolvedExtBinding { extCName = QualName { @@ -17118,7 +17217,8 @@ nameHsIdent = Identifier "filename"}) (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimChar (PrimSignImplicit Nothing)))))], @@ -17495,7 +17595,8 @@ "items"}) (TypePointer (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimChar (PrimSignImplicit Nothing)))))), @@ -17790,7 +17891,8 @@ nameHsIdent = Identifier "input"}) (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimChar (PrimSignImplicit @@ -18602,7 +18704,9 @@ nameC = Name "src", nameHsIdent = Identifier "src"}) (TypePointer - (TypeConst TypeVoid)), + (TypeQualified + TypeQualifierConst + TypeVoid)), _×_ (Just NamePair { @@ -19202,7 +19306,8 @@ nameHsIdent = Identifier "data'"}) (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypeExtBinding ResolvedExtBinding { extCName = QualName { @@ -20202,7 +20307,8 @@ nameHsIdent = Identifier "input_data"}) (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypeExtBinding ResolvedExtBinding { extCName = QualName { @@ -20689,7 +20795,8 @@ nameHsIdent = Identifier "filename"}) (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimChar (PrimSignImplicit Nothing)))))], @@ -21066,7 +21173,8 @@ "items"}) (TypePointer (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimChar (PrimSignImplicit Nothing)))))), @@ -21361,7 +21469,8 @@ nameHsIdent = Identifier "input"}) (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimChar (PrimSignImplicit @@ -22173,7 +22282,9 @@ nameC = Name "src", nameHsIdent = Identifier "src"}) (TypePointer - (TypeConst TypeVoid)), + (TypeQualified + TypeQualifierConst + TypeVoid)), _×_ (Just NamePair { @@ -22773,7 +22884,8 @@ nameHsIdent = Identifier "data'"}) (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypeExtBinding ResolvedExtBinding { extCName = QualName { @@ -23708,7 +23820,8 @@ (TypeFun [ TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypeExtBinding ResolvedExtBinding { extCName = QualName { @@ -24095,7 +24208,8 @@ (TypeFun [ TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimChar (PrimSignImplicit Nothing))))] @@ -24207,7 +24321,8 @@ [ TypePointer (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimChar (PrimSignImplicit Nothing))))), @@ -24276,7 +24391,8 @@ (TypeFun [ TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimChar (PrimSignImplicit @@ -24769,7 +24885,9 @@ [ TypePointer TypeVoid, TypePointer - (TypeConst TypeVoid), + (TypeQualified + TypeQualifierConst + TypeVoid), TypeExtBinding ResolvedExtBinding { extCName = QualName { @@ -25199,7 +25317,8 @@ (AnonId "doxygen_docs.h:232:9"))))), TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypeExtBinding ResolvedExtBinding { extCName = QualName { @@ -25570,7 +25689,8 @@ "doxygen_docs.h"}, foreignImportOrigin = Global (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimChar (PrimSignImplicit diff --git a/hs-bindgen/fixtures/doxygen_docs.tree-diff.txt b/hs-bindgen/fixtures/doxygen_docs.tree-diff.txt index d12b63449..922e359e6 100644 --- a/hs-bindgen/fixtures/doxygen_docs.tree-diff.txt +++ b/hs-bindgen/fixtures/doxygen_docs.tree-diff.txt @@ -283,7 +283,8 @@ TranslationUnit { "Version string constant"]}])}, declKind = DeclGlobal (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimChar (PrimSignImplicit @@ -548,7 +549,8 @@ TranslationUnit { nameHsIdent = Identifier "input_data"}) (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypeExtBinding ResolvedExtBinding { extCName = QualName { @@ -1029,7 +1031,8 @@ TranslationUnit { nameHsIdent = Identifier "filename"}) (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimChar (PrimSignImplicit Nothing)))))], @@ -1413,7 +1416,8 @@ TranslationUnit { "items"}) (TypePointer (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimChar (PrimSignImplicit Nothing)))))), @@ -1597,7 +1601,8 @@ TranslationUnit { nameHsIdent = Identifier "input"}) (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimChar (PrimSignImplicit @@ -1895,7 +1900,16 @@ TranslationUnit { nameC = Name "event_callback_t_Deref", nameHsIdent = Identifier - "Event_callback_t_Deref"}))}, + "Event_callback_t_Deref"} + (TypeFun + [ + TypePrim + (PrimIntegral PrimInt Signed), + TypePointer TypeVoid] + (TypePrim + (PrimIntegral + PrimInt + Signed)))))}, declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, @@ -2273,7 +2287,17 @@ TranslationUnit { NamePair { nameC = Name "event_callback_t", nameHsIdent = Identifier - "Event_callback_t"}), + "Event_callback_t"} + (TypePointer + (TypeFun + [ + TypePrim + (PrimIntegral PrimInt Signed), + TypePointer TypeVoid] + (TypePrim + (PrimIntegral + PrimInt + Signed))))), structFieldOffset = 576, structFieldWidth = Nothing}, StructField { @@ -3411,7 +3435,16 @@ TranslationUnit { nameC = Name "processor_fn_t_Deref", nameHsIdent = Identifier - "Processor_fn_t_Deref"}))}, + "Processor_fn_t_Deref"} + (TypeFun + [ + TypePrim + (PrimIntegral PrimInt Signed), + TypePointer TypeVoid] + (TypePrim + (PrimIntegral + PrimInt + Signed)))))}, declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, @@ -3762,7 +3795,9 @@ TranslationUnit { nameC = Name "src", nameHsIdent = Identifier "src"}) (TypePointer - (TypeConst TypeVoid)), + (TypeQualified + TypeQualifierConst + TypeVoid)), _×_ (Just NamePair { @@ -4405,7 +4440,8 @@ TranslationUnit { nameHsIdent = Identifier "data'"}) (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypeExtBinding ResolvedExtBinding { extCName = QualName { diff --git a/hs-bindgen/fixtures/fun_attributes.hs b/hs-bindgen/fixtures/fun_attributes.hs index 74a25cee2..08034f3d6 100644 --- a/hs-bindgen/fixtures/fun_attributes.hs +++ b/hs-bindgen/fixtures/fun_attributes.hs @@ -685,7 +685,11 @@ NamePair { nameC = Name "size_t", nameHsIdent = Identifier - "Size_t"})), + "Size_t"} + (TypePrim + (PrimIntegral + PrimInt + Signed)))), _×_ Nothing (TypeTypedef @@ -693,7 +697,11 @@ NamePair { nameC = Name "size_t", nameHsIdent = Identifier - "Size_t"}))], + "Size_t"} + (TypePrim + (PrimIntegral + PrimInt + Signed))))], functionAttrs = FunctionAttributes ImpureFunction, @@ -756,7 +764,11 @@ NamePair { nameC = Name "size_t", nameHsIdent = Identifier - "Size_t"})), + "Size_t"} + (TypePrim + (PrimIntegral + PrimInt + Signed)))), _×_ Nothing (TypeTypedef @@ -764,7 +776,11 @@ NamePair { nameC = Name "size_t", nameHsIdent = Identifier - "Size_t"}))], + "Size_t"} + (TypePrim + (PrimIntegral + PrimInt + Signed))))], functionAttrs = FunctionAttributes ImpureFunction, @@ -830,7 +846,11 @@ NamePair { nameC = Name "size_t", nameHsIdent = Identifier - "Size_t"}))], + "Size_t"} + (TypePrim + (PrimIntegral + PrimInt + Signed))))], functionAttrs = FunctionAttributes ImpureFunction, @@ -887,7 +907,11 @@ NamePair { nameC = Name "size_t", nameHsIdent = Identifier - "Size_t"}))], + "Size_t"} + (TypePrim + (PrimIntegral + PrimInt + Signed))))], functionAttrs = FunctionAttributes ImpureFunction, @@ -944,7 +968,11 @@ NamePair { nameC = Name "size_t", nameHsIdent = Identifier - "Size_t"}))], + "Size_t"} + (TypePrim + (PrimIntegral + PrimInt + Signed))))], functionAttrs = FunctionAttributes ImpureFunction, @@ -1122,7 +1150,8 @@ nameHsIdent = Identifier "my_format"}) (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimChar (PrimSignImplicit @@ -1195,7 +1224,8 @@ _×_ Nothing (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimChar (PrimSignImplicit @@ -1339,7 +1369,9 @@ nameC = Name "src", nameHsIdent = Identifier "src"}) (TypePointer - (TypeConst TypeVoid)), + (TypeQualified + TypeQualifierConst + TypeVoid)), _×_ (Just NamePair { @@ -1350,7 +1382,11 @@ NamePair { nameC = Name "size_t", nameHsIdent = Identifier - "Size_t"}))], + "Size_t"} + (TypePrim + (PrimIntegral + PrimInt + Signed))))], functionAttrs = FunctionAttributes ImpureFunction, @@ -1517,7 +1553,11 @@ NamePair { nameC = Name "size_t", nameHsIdent = Identifier - "Size_t"}))], + "Size_t"} + (TypePrim + (PrimIntegral + PrimInt + Signed))))], functionAttrs = FunctionAttributes ImpureFunction, @@ -1977,7 +2017,11 @@ NamePair { nameC = Name "size_t", nameHsIdent = Identifier - "Size_t"})), + "Size_t"} + (TypePrim + (PrimIntegral + PrimInt + Signed)))), _×_ Nothing (TypeTypedef @@ -1985,7 +2029,11 @@ NamePair { nameC = Name "size_t", nameHsIdent = Identifier - "Size_t"}))], + "Size_t"} + (TypePrim + (PrimIntegral + PrimInt + Signed))))], functionAttrs = FunctionAttributes ImpureFunction, @@ -2048,7 +2096,11 @@ NamePair { nameC = Name "size_t", nameHsIdent = Identifier - "Size_t"})), + "Size_t"} + (TypePrim + (PrimIntegral + PrimInt + Signed)))), _×_ Nothing (TypeTypedef @@ -2056,7 +2108,11 @@ NamePair { nameC = Name "size_t", nameHsIdent = Identifier - "Size_t"}))], + "Size_t"} + (TypePrim + (PrimIntegral + PrimInt + Signed))))], functionAttrs = FunctionAttributes ImpureFunction, @@ -2122,7 +2178,11 @@ NamePair { nameC = Name "size_t", nameHsIdent = Identifier - "Size_t"}))], + "Size_t"} + (TypePrim + (PrimIntegral + PrimInt + Signed))))], functionAttrs = FunctionAttributes ImpureFunction, @@ -2179,7 +2239,11 @@ NamePair { nameC = Name "size_t", nameHsIdent = Identifier - "Size_t"}))], + "Size_t"} + (TypePrim + (PrimIntegral + PrimInt + Signed))))], functionAttrs = FunctionAttributes ImpureFunction, @@ -2236,7 +2300,11 @@ NamePair { nameC = Name "size_t", nameHsIdent = Identifier - "Size_t"}))], + "Size_t"} + (TypePrim + (PrimIntegral + PrimInt + Signed))))], functionAttrs = FunctionAttributes ImpureFunction, @@ -2414,7 +2482,8 @@ nameHsIdent = Identifier "my_format"}) (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimChar (PrimSignImplicit @@ -2487,7 +2556,8 @@ _×_ Nothing (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimChar (PrimSignImplicit @@ -2631,7 +2701,9 @@ nameC = Name "src", nameHsIdent = Identifier "src"}) (TypePointer - (TypeConst TypeVoid)), + (TypeQualified + TypeQualifierConst + TypeVoid)), _×_ (Just NamePair { @@ -2642,7 +2714,11 @@ NamePair { nameC = Name "size_t", nameHsIdent = Identifier - "Size_t"}))], + "Size_t"} + (TypePrim + (PrimIntegral + PrimInt + Signed))))], functionAttrs = FunctionAttributes ImpureFunction, @@ -2809,7 +2885,11 @@ NamePair { nameC = Name "size_t", nameHsIdent = Identifier - "Size_t"}))], + "Size_t"} + (TypePrim + (PrimIntegral + PrimInt + Signed))))], functionAttrs = FunctionAttributes ImpureFunction, @@ -3239,13 +3319,17 @@ NamePair { nameC = Name "size_t", nameHsIdent = Identifier - "Size_t"}), + "Size_t"} + (TypePrim + (PrimIntegral PrimInt Signed))), TypeTypedef (TypedefRegular NamePair { nameC = Name "size_t", nameHsIdent = Identifier - "Size_t"})] + "Size_t"} + (TypePrim + (PrimIntegral PrimInt Signed)))] (TypePointer TypeVoid)), foreignImportComment = Nothing, foreignImportSafety = Unsafe}, @@ -3287,13 +3371,17 @@ NamePair { nameC = Name "size_t", nameHsIdent = Identifier - "Size_t"}), + "Size_t"} + (TypePrim + (PrimIntegral PrimInt Signed))), TypeTypedef (TypedefRegular NamePair { nameC = Name "size_t", nameHsIdent = Identifier - "Size_t"})] + "Size_t"} + (TypePrim + (PrimIntegral PrimInt Signed)))] (TypePointer TypeVoid)), foreignImportComment = Nothing, foreignImportSafety = Unsafe}, @@ -3335,7 +3423,9 @@ NamePair { nameC = Name "size_t", nameHsIdent = Identifier - "Size_t"})] + "Size_t"} + (TypePrim + (PrimIntegral PrimInt Signed)))] (TypePointer TypeVoid)), foreignImportComment = Nothing, foreignImportSafety = Unsafe}, @@ -3374,7 +3464,9 @@ NamePair { nameC = Name "size_t", nameHsIdent = Identifier - "Size_t"})] + "Size_t"} + (TypePrim + (PrimIntegral PrimInt Signed)))] (TypePointer TypeVoid)), foreignImportComment = Nothing, foreignImportSafety = Unsafe}, @@ -3413,7 +3505,9 @@ NamePair { nameC = Name "size_t", nameHsIdent = Identifier - "Size_t"})] + "Size_t"} + (TypePrim + (PrimIntegral PrimInt Signed)))] (TypePointer TypeVoid)), foreignImportComment = Nothing, foreignImportSafety = Unsafe}, @@ -3518,7 +3612,8 @@ (PrimSignImplicit (Just Signed)))), TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimChar (PrimSignImplicit @@ -3567,7 +3662,8 @@ TypePrim (PrimIntegral PrimInt Signed), TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimChar (PrimSignImplicit @@ -3648,13 +3744,17 @@ [ TypePointer TypeVoid, TypePointer - (TypeConst TypeVoid), + (TypeQualified + TypeQualifierConst + TypeVoid), TypeTypedef (TypedefRegular NamePair { nameC = Name "size_t", nameHsIdent = Identifier - "Size_t"})] + "Size_t"} + (TypePrim + (PrimIntegral PrimInt Signed)))] (TypePointer TypeVoid)), foreignImportComment = Nothing, foreignImportSafety = Unsafe}, @@ -3757,7 +3857,9 @@ NamePair { nameC = Name "size_t", nameHsIdent = Identifier - "Size_t"})] + "Size_t"} + (TypePrim + (PrimIntegral PrimInt Signed)))] (TypePointer TypeVoid)), foreignImportComment = Nothing, foreignImportSafety = Unsafe}, diff --git a/hs-bindgen/fixtures/fun_attributes.tree-diff.txt b/hs-bindgen/fixtures/fun_attributes.tree-diff.txt index 2048c2f9b..ebb5099a5 100644 --- a/hs-bindgen/fixtures/fun_attributes.tree-diff.txt +++ b/hs-bindgen/fixtures/fun_attributes.tree-diff.txt @@ -165,7 +165,11 @@ TranslationUnit { NamePair { nameC = Name "size_t", nameHsIdent = Identifier - "Size_t"})), + "Size_t"} + (TypePrim + (PrimIntegral + PrimInt + Signed)))), _×_ Nothing (TypeTypedef @@ -173,7 +177,11 @@ TranslationUnit { NamePair { nameC = Name "size_t", nameHsIdent = Identifier - "Size_t"}))], + "Size_t"} + (TypePrim + (PrimIntegral + PrimInt + Signed))))], functionAttrs = FunctionAttributes ImpureFunction, @@ -212,7 +220,11 @@ TranslationUnit { NamePair { nameC = Name "size_t", nameHsIdent = Identifier - "Size_t"})), + "Size_t"} + (TypePrim + (PrimIntegral + PrimInt + Signed)))), _×_ Nothing (TypeTypedef @@ -220,7 +232,11 @@ TranslationUnit { NamePair { nameC = Name "size_t", nameHsIdent = Identifier - "Size_t"}))], + "Size_t"} + (TypePrim + (PrimIntegral + PrimInt + Signed))))], functionAttrs = FunctionAttributes ImpureFunction, @@ -262,7 +278,11 @@ TranslationUnit { NamePair { nameC = Name "size_t", nameHsIdent = Identifier - "Size_t"}))], + "Size_t"} + (TypePrim + (PrimIntegral + PrimInt + Signed))))], functionAttrs = FunctionAttributes ImpureFunction, @@ -301,7 +321,11 @@ TranslationUnit { NamePair { nameC = Name "size_t", nameHsIdent = Identifier - "Size_t"}))], + "Size_t"} + (TypePrim + (PrimIntegral + PrimInt + Signed))))], functionAttrs = FunctionAttributes ImpureFunction, @@ -340,7 +364,11 @@ TranslationUnit { NamePair { nameC = Name "size_t", nameHsIdent = Identifier - "Size_t"}))], + "Size_t"} + (TypePrim + (PrimIntegral + PrimInt + Signed))))], functionAttrs = FunctionAttributes ImpureFunction, @@ -456,7 +484,8 @@ TranslationUnit { nameHsIdent = Identifier "my_format"}) (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimChar (PrimSignImplicit @@ -502,7 +531,8 @@ TranslationUnit { _×_ Nothing (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimChar (PrimSignImplicit @@ -589,7 +619,9 @@ TranslationUnit { nameC = Name "src", nameHsIdent = Identifier "src"}) (TypePointer - (TypeConst TypeVoid)), + (TypeQualified + TypeQualifierConst + TypeVoid)), _×_ (Just NamePair { @@ -600,7 +632,11 @@ TranslationUnit { NamePair { nameC = Name "size_t", nameHsIdent = Identifier - "Size_t"}))], + "Size_t"} + (TypePrim + (PrimIntegral + PrimInt + Signed))))], functionAttrs = FunctionAttributes ImpureFunction, @@ -710,7 +746,11 @@ TranslationUnit { NamePair { nameC = Name "size_t", nameHsIdent = Identifier - "Size_t"}))], + "Size_t"} + (TypePrim + (PrimIntegral + PrimInt + Signed))))], functionAttrs = FunctionAttributes ImpureFunction, diff --git a/hs-bindgen/fixtures/globals.hs b/hs-bindgen/fixtures/globals.hs index 23f05d6ef..189812f84 100644 --- a/hs-bindgen/fixtures/globals.hs +++ b/hs-bindgen/fixtures/globals.hs @@ -8853,7 +8853,8 @@ newtypeField = Name "@NsVar" "un_ConstInt"}, - typedefType = TypeConst + typedefType = TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt Signed))}, declSpec = DeclSpec @@ -9074,7 +9075,8 @@ "un_ConstIntArray"}, typedefType = TypeIncompleteArray - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt @@ -9178,7 +9180,8 @@ nameHsIdent = Identifier "tuple_y"}, fieldComment = Nothing}, - structFieldType = TypeConst + structFieldType = TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt Signed)), structFieldOffset = 32, @@ -9238,7 +9241,8 @@ nameHsIdent = Identifier "tuple_y"}, fieldComment = Nothing}, - structFieldType = TypeConst + structFieldType = TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt Signed)), structFieldOffset = 32, @@ -9322,7 +9326,8 @@ nameHsIdent = Identifier "tuple_y"}, fieldComment = Nothing}, - structFieldType = TypeConst + structFieldType = TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt Signed)), structFieldOffset = 32, @@ -9382,7 +9387,8 @@ nameHsIdent = Identifier "tuple_y"}, fieldComment = Nothing}, - structFieldType = TypeConst + structFieldType = TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt Signed)), structFieldOffset = 32, @@ -9469,7 +9475,8 @@ nameHsIdent = Identifier "tuple_y"}, fieldComment = Nothing}, - structFieldType = TypeConst + structFieldType = TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt Signed)), structFieldOffset = 32, @@ -9529,7 +9536,8 @@ nameHsIdent = Identifier "tuple_y"}, fieldComment = Nothing}, - structFieldType = TypeConst + structFieldType = TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt Signed)), structFieldOffset = 32, @@ -9618,7 +9626,8 @@ nameHsIdent = Identifier "tuple_y"}, fieldComment = Nothing}, - structFieldType = TypeConst + structFieldType = TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt Signed)), structFieldOffset = 32, @@ -9678,7 +9687,8 @@ nameHsIdent = Identifier "tuple_y"}, fieldComment = Nothing}, - structFieldType = TypeConst + structFieldType = TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt Signed)), structFieldOffset = 32, @@ -10992,7 +11002,8 @@ capiWrapperImport = "globals.h"}, foreignImportOrigin = Global - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt Signed))), foreignImportComment = Nothing, @@ -11030,7 +11041,13 @@ NamePair { nameC = Name "ConstInt", nameHsIdent = Identifier - "ConstInt"})), + "ConstInt"} + (TypeQualified + TypeQualifierConst + (TypePrim + (PrimIntegral + PrimInt + Signed))))), foreignImportComment = Nothing, foreignImportSafety = Unsafe}, DeclSimple, @@ -11058,7 +11075,8 @@ capiWrapperImport = "globals.h"}, foreignImportOrigin = Global - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt Signed))), foreignImportComment = Nothing, @@ -11088,7 +11106,8 @@ capiWrapperImport = "globals.h"}, foreignImportOrigin = Global - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt Signed))), foreignImportComment = Nothing, @@ -11122,7 +11141,8 @@ foreignImportOrigin = Global (TypeConstArray 4 - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt @@ -11162,7 +11182,14 @@ NamePair { nameC = Name "ConstIntArray", nameHsIdent = Identifier - "ConstIntArray"})), + "ConstIntArray"} + (TypeIncompleteArray + (TypeQualified + TypeQualifierConst + (TypePrim + (PrimIntegral + PrimInt + Signed)))))), foreignImportComment = Nothing, foreignImportSafety = Unsafe}, DeclSimple, @@ -11191,7 +11218,8 @@ capiWrapperImport = "globals.h"}, foreignImportOrigin = Global - (TypeConst + (TypeQualified + TypeQualifierConst (TypeStruct NamePair { nameC = Name "tuple", @@ -11261,7 +11289,8 @@ "globals.h"}, foreignImportOrigin = Global (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt @@ -11292,7 +11321,8 @@ capiWrapperImport = "globals.h"}, foreignImportOrigin = Global - (TypeConst + (TypeQualified + TypeQualifierConst (TypePointer (TypePrim (PrimIntegral @@ -11326,9 +11356,11 @@ capiWrapperImport = "globals.h"}, foreignImportOrigin = Global - (TypeConst + (TypeQualified + TypeQualifierConst (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt diff --git a/hs-bindgen/fixtures/globals.tree-diff.txt b/hs-bindgen/fixtures/globals.tree-diff.txt index 67e422d64..323f4381a 100644 --- a/hs-bindgen/fixtures/globals.tree-diff.txt +++ b/hs-bindgen/fixtures/globals.tree-diff.txt @@ -1681,7 +1681,8 @@ TranslationUnit { "Although this is a constant, we don't expect an initializer (since it's", TextContent "`extern`)."]])}, declKind = DeclGlobal - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt Signed))), declSpec = DeclSpec @@ -1720,7 +1721,8 @@ TranslationUnit { newtypeField = Name "@NsVar" "un_ConstInt"}, - typedefType = TypeConst + typedefType = TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt Signed))}, declSpec = DeclSpec @@ -1751,7 +1753,13 @@ TranslationUnit { NamePair { nameC = Name "ConstInt", nameHsIdent = Identifier - "ConstInt"})), + "ConstInt"} + (TypeQualified + TypeQualifierConst + (TypePrim + (PrimIntegral + PrimInt + Signed))))), declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, @@ -1786,7 +1794,8 @@ TranslationUnit { TextContent "Unlike with `extern`, in this we _do_ expect an initializer."]])}, declKind = DeclGlobal - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt Signed))), declSpec = DeclSpec @@ -1817,7 +1826,8 @@ TranslationUnit { TextContent "No storage class specified"]])}, declKind = DeclGlobal - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt Signed))), declSpec = DeclSpec @@ -1850,7 +1860,8 @@ TranslationUnit { declKind = DeclGlobal (TypeConstArray 4 - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt @@ -1893,7 +1904,8 @@ TranslationUnit { "un_ConstIntArray"}, typedefType = TypeIncompleteArray - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt @@ -1925,7 +1937,14 @@ TranslationUnit { NamePair { nameC = Name "ConstIntArray", nameHsIdent = Identifier - "ConstIntArray"})), + "ConstIntArray"} + (TypeIncompleteArray + (TypeQualified + TypeQualifierConst + (TypePrim + (PrimIntegral + PrimInt + Signed)))))), declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, @@ -1974,7 +1993,8 @@ TranslationUnit { nameHsIdent = Identifier "tuple_y"}, fieldComment = Nothing}, - structFieldType = TypeConst + structFieldType = TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt Signed)), structFieldOffset = 32, @@ -2008,7 +2028,8 @@ TranslationUnit { TextContent "A constant tuple"]])}, declKind = DeclGlobal - (TypeConst + (TypeQualified + TypeQualifierConst (TypeStruct NamePair { nameC = Name "tuple", @@ -2078,7 +2099,8 @@ TranslationUnit { "A pointer to const int"]])}, declKind = DeclGlobal (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt @@ -2111,7 +2133,8 @@ TranslationUnit { TextContent "A const pointer to int"]])}, declKind = DeclGlobal - (TypeConst + (TypeQualified + TypeQualifierConst (TypePointer (TypePrim (PrimIntegral @@ -2146,9 +2169,11 @@ TranslationUnit { TextContent "A const pointer to const int"]])}, declKind = DeclGlobal - (TypeConst + (TypeQualified + TypeQualifierConst (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt diff --git a/hs-bindgen/fixtures/hsb_complex_test.hs b/hs-bindgen/fixtures/hsb_complex_test.hs index 51e0659a5..9e2a9d563 100644 --- a/hs-bindgen/fixtures/hsb_complex_test.hs +++ b/hs-bindgen/fixtures/hsb_complex_test.hs @@ -1483,7 +1483,8 @@ capiWrapperImport = "hsb_complex_test.h"}, foreignImportOrigin = Global - (TypeConst + (TypeQualified + TypeQualifierConst (TypeComplex (PrimFloating PrimFloat))), foreignImportComment = Nothing, @@ -1513,7 +1514,8 @@ capiWrapperImport = "hsb_complex_test.h"}, foreignImportOrigin = Global - (TypeConst + (TypeQualified + TypeQualifierConst (TypeComplex (PrimFloating PrimDouble))), foreignImportComment = Nothing, diff --git a/hs-bindgen/fixtures/hsb_complex_test.tree-diff.txt b/hs-bindgen/fixtures/hsb_complex_test.tree-diff.txt index a7bc0c6eb..a786adbef 100644 --- a/hs-bindgen/fixtures/hsb_complex_test.tree-diff.txt +++ b/hs-bindgen/fixtures/hsb_complex_test.tree-diff.txt @@ -235,7 +235,8 @@ TranslationUnit { "hsb_complex_test.h"}, declComment = Nothing}, declKind = DeclGlobal - (TypeConst + (TypeQualified + TypeQualifierConst (TypeComplex (PrimFloating PrimFloat))), declSpec = DeclSpec @@ -263,7 +264,8 @@ TranslationUnit { "hsb_complex_test.h"}, declComment = Nothing}, declKind = DeclGlobal - (TypeConst + (TypeQualified + TypeQualifierConst (TypeComplex (PrimFloating PrimDouble))), declSpec = DeclSpec diff --git a/hs-bindgen/fixtures/iterator.hs b/hs-bindgen/fixtures/iterator.hs index b8070bddb..3c145cf23 100644 --- a/hs-bindgen/fixtures/iterator.hs +++ b/hs-bindgen/fixtures/iterator.hs @@ -254,7 +254,11 @@ NamePair { nameC = Name "Toggle", nameHsIdent = Identifier - "Toggle"})}, + "Toggle"} + (TypeBlock + (TypeFun + [] + (TypePrim PrimBool))))}, foreignImportComment = Just Comment { commentTitle = Nothing, @@ -313,7 +317,11 @@ NamePair { nameC = Name "Toggle", nameHsIdent = Identifier - "Toggle"}))], + "Toggle"} + (TypeBlock + (TypeFun + [] + (TypePrim PrimBool)))))], functionAttrs = FunctionAttributes ImpureFunction, @@ -377,7 +385,11 @@ NamePair { nameC = Name "Toggle", nameHsIdent = Identifier - "Toggle"}))], + "Toggle"} + (TypeBlock + (TypeFun + [] + (TypePrim PrimBool)))))], functionAttrs = FunctionAttributes ImpureFunction, @@ -470,7 +482,14 @@ NamePair { nameC = Name "Counter", nameHsIdent = Identifier - "Counter"})}, + "Counter"} + (TypeBlock + (TypeFun + [] + (TypePrim + (PrimIntegral + PrimInt + Signed)))))}, foreignImportComment = Just Comment { commentTitle = Nothing, @@ -531,7 +550,14 @@ NamePair { nameC = Name "Counter", nameHsIdent = Identifier - "Counter"}))], + "Counter"} + (TypeBlock + (TypeFun + [] + (TypePrim + (PrimIntegral + PrimInt + Signed))))))], functionAttrs = FunctionAttributes ImpureFunction, @@ -597,7 +623,14 @@ NamePair { nameC = Name "Counter", nameHsIdent = Identifier - "Counter"}))], + "Counter"} + (TypeBlock + (TypeFun + [] + (TypePrim + (PrimIntegral + PrimInt + Signed))))))], functionAttrs = FunctionAttributes ImpureFunction, @@ -669,7 +702,16 @@ NamePair { nameC = Name "VarCounter", nameHsIdent = Identifier - "VarCounter"})}, + "VarCounter"} + (TypeBlock + (TypeFun + [ + TypePrim + (PrimIntegral PrimInt Signed)] + (TypePrim + (PrimIntegral + PrimInt + Signed)))))}, foreignImportComment = Just Comment { commentTitle = Nothing, @@ -743,7 +785,16 @@ NamePair { nameC = Name "VarCounter", nameHsIdent = Identifier - "VarCounter"})), + "VarCounter"} + (TypeBlock + (TypeFun + [ + TypePrim + (PrimIntegral PrimInt Signed)] + (TypePrim + (PrimIntegral + PrimInt + Signed)))))), _×_ (Just NamePair { @@ -817,7 +868,16 @@ NamePair { nameC = Name "VarCounter", nameHsIdent = Identifier - "VarCounter"}))], + "VarCounter"} + (TypeBlock + (TypeFun + [ + TypePrim + (PrimIntegral PrimInt Signed)] + (TypePrim + (PrimIntegral + PrimInt + Signed))))))], functionAttrs = FunctionAttributes ImpureFunction, @@ -888,7 +948,11 @@ NamePair { nameC = Name "Toggle", nameHsIdent = Identifier - "Toggle"})}, + "Toggle"} + (TypeBlock + (TypeFun + [] + (TypePrim PrimBool))))}, foreignImportComment = Just Comment { commentTitle = Nothing, @@ -947,7 +1011,11 @@ NamePair { nameC = Name "Toggle", nameHsIdent = Identifier - "Toggle"}))], + "Toggle"} + (TypeBlock + (TypeFun + [] + (TypePrim PrimBool)))))], functionAttrs = FunctionAttributes ImpureFunction, @@ -1011,7 +1079,11 @@ NamePair { nameC = Name "Toggle", nameHsIdent = Identifier - "Toggle"}))], + "Toggle"} + (TypeBlock + (TypeFun + [] + (TypePrim PrimBool)))))], functionAttrs = FunctionAttributes ImpureFunction, @@ -1104,7 +1176,14 @@ NamePair { nameC = Name "Counter", nameHsIdent = Identifier - "Counter"})}, + "Counter"} + (TypeBlock + (TypeFun + [] + (TypePrim + (PrimIntegral + PrimInt + Signed)))))}, foreignImportComment = Just Comment { commentTitle = Nothing, @@ -1165,7 +1244,14 @@ NamePair { nameC = Name "Counter", nameHsIdent = Identifier - "Counter"}))], + "Counter"} + (TypeBlock + (TypeFun + [] + (TypePrim + (PrimIntegral + PrimInt + Signed))))))], functionAttrs = FunctionAttributes ImpureFunction, @@ -1231,7 +1317,14 @@ NamePair { nameC = Name "Counter", nameHsIdent = Identifier - "Counter"}))], + "Counter"} + (TypeBlock + (TypeFun + [] + (TypePrim + (PrimIntegral + PrimInt + Signed))))))], functionAttrs = FunctionAttributes ImpureFunction, @@ -1303,7 +1396,16 @@ NamePair { nameC = Name "VarCounter", nameHsIdent = Identifier - "VarCounter"})}, + "VarCounter"} + (TypeBlock + (TypeFun + [ + TypePrim + (PrimIntegral PrimInt Signed)] + (TypePrim + (PrimIntegral + PrimInt + Signed)))))}, foreignImportComment = Just Comment { commentTitle = Nothing, @@ -1377,7 +1479,16 @@ NamePair { nameC = Name "VarCounter", nameHsIdent = Identifier - "VarCounter"})), + "VarCounter"} + (TypeBlock + (TypeFun + [ + TypePrim + (PrimIntegral PrimInt Signed)] + (TypePrim + (PrimIntegral + PrimInt + Signed)))))), _×_ (Just NamePair { @@ -1451,7 +1562,16 @@ NamePair { nameC = Name "VarCounter", nameHsIdent = Identifier - "VarCounter"}))], + "VarCounter"} + (TypeBlock + (TypeFun + [ + TypePrim + (PrimIntegral PrimInt Signed)] + (TypePrim + (PrimIntegral + PrimInt + Signed))))))], functionAttrs = FunctionAttributes ImpureFunction, @@ -1504,7 +1624,11 @@ NamePair { nameC = Name "Toggle", nameHsIdent = Identifier - "Toggle"}))), + "Toggle"} + (TypeBlock + (TypeFun + [] + (TypePrim PrimBool)))))), foreignImportComment = Nothing, foreignImportSafety = Unsafe}, DeclSimple, @@ -1541,7 +1665,11 @@ NamePair { nameC = Name "Toggle", nameHsIdent = Identifier - "Toggle"})] + "Toggle"} + (TypeBlock + (TypeFun + [] + (TypePrim PrimBool))))] (TypePrim PrimBool)), foreignImportComment = Nothing, foreignImportSafety = Unsafe}, @@ -1579,7 +1707,11 @@ NamePair { nameC = Name "Toggle", nameHsIdent = Identifier - "Toggle"})] + "Toggle"} + (TypeBlock + (TypeFun + [] + (TypePrim PrimBool))))] TypeVoid), foreignImportComment = Nothing, foreignImportSafety = Unsafe}, @@ -1625,7 +1757,14 @@ NamePair { nameC = Name "Counter", nameHsIdent = Identifier - "Counter"}))), + "Counter"} + (TypeBlock + (TypeFun + [] + (TypePrim + (PrimIntegral + PrimInt + Signed))))))), foreignImportComment = Nothing, foreignImportSafety = Unsafe}, DeclSimple, @@ -1664,7 +1803,14 @@ NamePair { nameC = Name "Counter", nameHsIdent = Identifier - "Counter"})] + "Counter"} + (TypeBlock + (TypeFun + [] + (TypePrim + (PrimIntegral + PrimInt + Signed)))))] (TypePrim (PrimIntegral PrimInt Signed))), foreignImportComment = Nothing, @@ -1705,7 +1851,14 @@ NamePair { nameC = Name "Counter", nameHsIdent = Identifier - "Counter"})] + "Counter"} + (TypeBlock + (TypeFun + [] + (TypePrim + (PrimIntegral + PrimInt + Signed)))))] TypeVoid), foreignImportComment = Nothing, foreignImportSafety = Unsafe}, @@ -1747,7 +1900,16 @@ NamePair { nameC = Name "VarCounter", nameHsIdent = Identifier - "VarCounter"}))), + "VarCounter"} + (TypeBlock + (TypeFun + [ + TypePrim + (PrimIntegral PrimInt Signed)] + (TypePrim + (PrimIntegral + PrimInt + Signed))))))), foreignImportComment = Nothing, foreignImportSafety = Unsafe}, DeclSimple, @@ -1788,7 +1950,16 @@ NamePair { nameC = Name "VarCounter", nameHsIdent = Identifier - "VarCounter"}), + "VarCounter"} + (TypeBlock + (TypeFun + [ + TypePrim + (PrimIntegral PrimInt Signed)] + (TypePrim + (PrimIntegral + PrimInt + Signed))))), TypePrim (PrimIntegral PrimInt Signed)] (TypePrim @@ -1831,7 +2002,16 @@ NamePair { nameC = Name "VarCounter", nameHsIdent = Identifier - "VarCounter"})] + "VarCounter"} + (TypeBlock + (TypeFun + [ + TypePrim + (PrimIntegral PrimInt Signed)] + (TypePrim + (PrimIntegral + PrimInt + Signed)))))] TypeVoid), foreignImportComment = Nothing, foreignImportSafety = Unsafe}, diff --git a/hs-bindgen/fixtures/iterator.tree-diff.txt b/hs-bindgen/fixtures/iterator.tree-diff.txt index 346954603..03d57c1ec 100644 --- a/hs-bindgen/fixtures/iterator.tree-diff.txt +++ b/hs-bindgen/fixtures/iterator.tree-diff.txt @@ -67,7 +67,11 @@ TranslationUnit { NamePair { nameC = Name "Toggle", nameHsIdent = Identifier - "Toggle"})}, + "Toggle"} + (TypeBlock + (TypeFun + [] + (TypePrim PrimBool))))}, declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, @@ -103,7 +107,11 @@ TranslationUnit { NamePair { nameC = Name "Toggle", nameHsIdent = Identifier - "Toggle"}))], + "Toggle"} + (TypeBlock + (TypeFun + [] + (TypePrim PrimBool)))))], functionAttrs = FunctionAttributes ImpureFunction, @@ -144,7 +152,11 @@ TranslationUnit { NamePair { nameC = Name "Toggle", nameHsIdent = Identifier - "Toggle"}))], + "Toggle"} + (TypeBlock + (TypeFun + [] + (TypePrim PrimBool)))))], functionAttrs = FunctionAttributes ImpureFunction, @@ -234,7 +246,14 @@ TranslationUnit { NamePair { nameC = Name "Counter", nameHsIdent = Identifier - "Counter"})}, + "Counter"} + (TypeBlock + (TypeFun + [] + (TypePrim + (PrimIntegral + PrimInt + Signed)))))}, declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, @@ -270,7 +289,14 @@ TranslationUnit { NamePair { nameC = Name "Counter", nameHsIdent = Identifier - "Counter"}))], + "Counter"} + (TypeBlock + (TypeFun + [] + (TypePrim + (PrimIntegral + PrimInt + Signed))))))], functionAttrs = FunctionAttributes ImpureFunction, @@ -311,7 +337,14 @@ TranslationUnit { NamePair { nameC = Name "Counter", nameHsIdent = Identifier - "Counter"}))], + "Counter"} + (TypeBlock + (TypeFun + [] + (TypePrim + (PrimIntegral + PrimInt + Signed))))))], functionAttrs = FunctionAttributes ImpureFunction, @@ -395,7 +428,16 @@ TranslationUnit { NamePair { nameC = Name "VarCounter", nameHsIdent = Identifier - "VarCounter"})}, + "VarCounter"} + (TypeBlock + (TypeFun + [ + TypePrim + (PrimIntegral PrimInt Signed)] + (TypePrim + (PrimIntegral + PrimInt + Signed)))))}, declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, @@ -431,7 +473,16 @@ TranslationUnit { NamePair { nameC = Name "VarCounter", nameHsIdent = Identifier - "VarCounter"})), + "VarCounter"} + (TypeBlock + (TypeFun + [ + TypePrim + (PrimIntegral PrimInt Signed)] + (TypePrim + (PrimIntegral + PrimInt + Signed)))))), _×_ (Just NamePair { @@ -481,7 +532,16 @@ TranslationUnit { NamePair { nameC = Name "VarCounter", nameHsIdent = Identifier - "VarCounter"}))], + "VarCounter"} + (TypeBlock + (TypeFun + [ + TypePrim + (PrimIntegral PrimInt Signed)] + (TypePrim + (PrimIntegral + PrimInt + Signed))))))], functionAttrs = FunctionAttributes ImpureFunction, diff --git a/hs-bindgen/fixtures/macro_in_fundecl.hs b/hs-bindgen/fixtures/macro_in_fundecl.hs index a7b059880..16f2c295d 100644 --- a/hs-bindgen/fixtures/macro_in_fundecl.hs +++ b/hs-bindgen/fixtures/macro_in_fundecl.hs @@ -1827,7 +1827,8 @@ NamePair { nameC = Name "i", nameHsIdent = Identifier "i"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt @@ -1902,7 +1903,8 @@ NamePair { nameC = Name "i", nameHsIdent = Identifier "i"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "I", @@ -1979,7 +1981,8 @@ NamePair { nameC = Name "i", nameHsIdent = Identifier "i"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt @@ -2853,7 +2856,8 @@ NamePair { nameC = Name "i", nameHsIdent = Identifier "i"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt @@ -2928,7 +2932,8 @@ NamePair { nameC = Name "i", nameHsIdent = Identifier "i"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "I", @@ -3005,7 +3010,8 @@ NamePair { nameC = Name "i", nameHsIdent = Identifier "i"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt @@ -3559,7 +3565,8 @@ foreignImportOrigin = Global (TypeFun [ - TypeConst + TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt Signed))] (TypePointer @@ -3607,7 +3614,8 @@ foreignImportOrigin = Global (TypeFun [ - TypeConst + TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "I", @@ -3660,7 +3668,8 @@ foreignImportOrigin = Global (TypeFun [ - TypeConst + TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt Signed))] (TypePointer diff --git a/hs-bindgen/fixtures/macro_in_fundecl.tree-diff.txt b/hs-bindgen/fixtures/macro_in_fundecl.tree-diff.txt index b3143ddf5..aa20a7eff 100644 --- a/hs-bindgen/fixtures/macro_in_fundecl.tree-diff.txt +++ b/hs-bindgen/fixtures/macro_in_fundecl.tree-diff.txt @@ -663,7 +663,8 @@ TranslationUnit { NamePair { nameC = Name "i", nameHsIdent = Identifier "i"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt @@ -711,7 +712,8 @@ TranslationUnit { NamePair { nameC = Name "i", nameHsIdent = Identifier "i"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "I", @@ -760,7 +762,8 @@ TranslationUnit { NamePair { nameC = Name "i", nameHsIdent = Identifier "i"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt diff --git a/hs-bindgen/fixtures/macro_in_fundecl_vs_typedef.hs b/hs-bindgen/fixtures/macro_in_fundecl_vs_typedef.hs index 6c4f7e73d..6dc9d58fa 100644 --- a/hs-bindgen/fixtures/macro_in_fundecl_vs_typedef.hs +++ b/hs-bindgen/fixtures/macro_in_fundecl_vs_typedef.hs @@ -2458,8 +2458,11 @@ (TypedefRegular NamePair { nameC = Name "TC", - nameHsIdent = Identifier - "TC"}))], + nameHsIdent = Identifier "TC"} + (TypePrim + (PrimChar + (PrimSignImplicit + (Just Signed))))))], functionAttrs = FunctionAttributes ImpureFunction, @@ -2553,8 +2556,11 @@ (TypedefRegular NamePair { nameC = Name "TC", - nameHsIdent = Identifier - "TC"})}, + nameHsIdent = Identifier "TC"} + (TypePrim + (PrimChar + (PrimSignImplicit + (Just Signed)))))}, foreignImportComment = Just Comment { commentTitle = Nothing, @@ -2636,8 +2642,11 @@ (TypedefRegular NamePair { nameC = Name "TC", - nameHsIdent = Identifier - "TC"})))], + nameHsIdent = Identifier "TC"} + (TypePrim + (PrimChar + (PrimSignImplicit + (Just Signed)))))))], functionAttrs = FunctionAttributes ImpureFunction, @@ -2737,8 +2746,11 @@ (TypedefRegular NamePair { nameC = Name "TC", - nameHsIdent = Identifier - "TC"}))}, + nameHsIdent = Identifier "TC"} + (TypePrim + (PrimChar + (PrimSignImplicit + (Just Signed))))))}, foreignImportComment = Just Comment { commentTitle = Nothing, @@ -2908,7 +2920,13 @@ NamePair { nameC = Name "struct3_t", nameHsIdent = Identifier - "Struct3_t"}))), + "Struct3_t"} + (TypeStruct + NamePair { + nameC = Name "struct3", + nameHsIdent = Identifier + "Struct3"} + NameOriginInSource)))), _×_ (Just NamePair { @@ -3366,8 +3384,11 @@ (TypedefRegular NamePair { nameC = Name "TC", - nameHsIdent = Identifier - "TC"}))], + nameHsIdent = Identifier "TC"} + (TypePrim + (PrimChar + (PrimSignImplicit + (Just Signed))))))], functionAttrs = FunctionAttributes ImpureFunction, @@ -3461,8 +3482,11 @@ (TypedefRegular NamePair { nameC = Name "TC", - nameHsIdent = Identifier - "TC"})}, + nameHsIdent = Identifier "TC"} + (TypePrim + (PrimChar + (PrimSignImplicit + (Just Signed)))))}, foreignImportComment = Just Comment { commentTitle = Nothing, @@ -3544,8 +3568,11 @@ (TypedefRegular NamePair { nameC = Name "TC", - nameHsIdent = Identifier - "TC"})))], + nameHsIdent = Identifier "TC"} + (TypePrim + (PrimChar + (PrimSignImplicit + (Just Signed)))))))], functionAttrs = FunctionAttributes ImpureFunction, @@ -3645,8 +3672,11 @@ (TypedefRegular NamePair { nameC = Name "TC", - nameHsIdent = Identifier - "TC"}))}, + nameHsIdent = Identifier "TC"} + (TypePrim + (PrimChar + (PrimSignImplicit + (Just Signed))))))}, foreignImportComment = Just Comment { commentTitle = Nothing, @@ -3816,7 +3846,13 @@ NamePair { nameC = Name "struct3_t", nameHsIdent = Identifier - "Struct3_t"}))), + "Struct3_t"} + (TypeStruct + NamePair { + nameC = Name "struct3", + nameHsIdent = Identifier + "Struct3"} + NameOriginInSource)))), _×_ (Just NamePair { @@ -4249,7 +4285,11 @@ (TypedefRegular NamePair { nameC = Name "TC", - nameHsIdent = Identifier "TC"})] + nameHsIdent = Identifier "TC"} + (TypePrim + (PrimChar + (PrimSignImplicit + (Just Signed)))))] (TypePrim (PrimChar (PrimSignImplicit Nothing)))), @@ -4301,8 +4341,11 @@ (TypedefRegular NamePair { nameC = Name "TC", - nameHsIdent = Identifier - "TC"}))), + nameHsIdent = Identifier "TC"} + (TypePrim + (PrimChar + (PrimSignImplicit + (Just Signed))))))), foreignImportComment = Nothing, foreignImportSafety = Unsafe}, DeclSimple, @@ -4348,8 +4391,11 @@ (TypedefRegular NamePair { nameC = Name "TC", - nameHsIdent = Identifier - "TC"}))] + nameHsIdent = Identifier "TC"} + (TypePrim + (PrimChar + (PrimSignImplicit + (Just Signed))))))] (TypePointer (TypeMacroTypedef NamePair { @@ -4407,8 +4453,11 @@ (TypedefRegular NamePair { nameC = Name "TC", - nameHsIdent = Identifier - "TC"})))), + nameHsIdent = Identifier "TC"} + (TypePrim + (PrimChar + (PrimSignImplicit + (Just Signed)))))))), foreignImportComment = Nothing, foreignImportSafety = Unsafe}, DeclSimple, @@ -4507,7 +4556,13 @@ NamePair { nameC = Name "struct3_t", nameHsIdent = Identifier - "Struct3_t"})), + "Struct3_t"} + (TypeStruct + NamePair { + nameC = Name "struct3", + nameHsIdent = Identifier + "Struct3"} + NameOriginInSource))), TypeMacroTypedef NamePair { nameC = Name "MC", diff --git a/hs-bindgen/fixtures/macro_in_fundecl_vs_typedef.tree-diff.txt b/hs-bindgen/fixtures/macro_in_fundecl_vs_typedef.tree-diff.txt index 6ca7c6cc1..0ad8b5b83 100644 --- a/hs-bindgen/fixtures/macro_in_fundecl_vs_typedef.tree-diff.txt +++ b/hs-bindgen/fixtures/macro_in_fundecl_vs_typedef.tree-diff.txt @@ -112,8 +112,11 @@ TranslationUnit { (TypedefRegular NamePair { nameC = Name "TC", - nameHsIdent = Identifier - "TC"}))], + nameHsIdent = Identifier "TC"} + (TypePrim + (PrimChar + (PrimSignImplicit + (Just Signed))))))], functionAttrs = FunctionAttributes ImpureFunction, @@ -172,8 +175,11 @@ TranslationUnit { (TypedefRegular NamePair { nameC = Name "TC", - nameHsIdent = Identifier - "TC"})}, + nameHsIdent = Identifier "TC"} + (TypePrim + (PrimChar + (PrimSignImplicit + (Just Signed)))))}, declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, @@ -218,8 +224,11 @@ TranslationUnit { (TypedefRegular NamePair { nameC = Name "TC", - nameHsIdent = Identifier - "TC"})))], + nameHsIdent = Identifier "TC"} + (TypePrim + (PrimChar + (PrimSignImplicit + (Just Signed)))))))], functionAttrs = FunctionAttributes ImpureFunction, @@ -282,8 +291,11 @@ TranslationUnit { (TypedefRegular NamePair { nameC = Name "TC", - nameHsIdent = Identifier - "TC"}))}, + nameHsIdent = Identifier "TC"} + (TypePrim + (PrimChar + (PrimSignImplicit + (Just Signed))))))}, declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, @@ -602,7 +614,13 @@ TranslationUnit { NamePair { nameC = Name "struct3_t", nameHsIdent = Identifier - "Struct3_t"}))), + "Struct3_t"} + (TypeStruct + NamePair { + nameC = Name "struct3", + nameHsIdent = Identifier + "Struct3"} + NameOriginInSource)))), _×_ (Just NamePair { diff --git a/hs-bindgen/fixtures/macro_typedef_scope.hs b/hs-bindgen/fixtures/macro_typedef_scope.hs index 5557eed4b..7c340fdde 100644 --- a/hs-bindgen/fixtures/macro_typedef_scope.hs +++ b/hs-bindgen/fixtures/macro_typedef_scope.hs @@ -463,8 +463,11 @@ (TypedefRegular NamePair { nameC = Name "T2", - nameHsIdent = Identifier - "T2"})}, + nameHsIdent = Identifier "T2"} + (TypePrim + (PrimIntegral + PrimInt + Signed)))}, declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, diff --git a/hs-bindgen/fixtures/macro_typedef_scope.tree-diff.txt b/hs-bindgen/fixtures/macro_typedef_scope.tree-diff.txt index dfae2b33a..00489cb55 100644 --- a/hs-bindgen/fixtures/macro_typedef_scope.tree-diff.txt +++ b/hs-bindgen/fixtures/macro_typedef_scope.tree-diff.txt @@ -100,8 +100,11 @@ TranslationUnit { (TypedefRegular NamePair { nameC = Name "T2", - nameHsIdent = Identifier - "T2"})}), + nameHsIdent = Identifier "T2"} + (TypePrim + (PrimIntegral + PrimInt + Signed)))}), declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, diff --git a/hs-bindgen/fixtures/manual/function_pointers.hs b/hs-bindgen/fixtures/manual/function_pointers.hs index 20b90d244..f2fa7f8de 100644 --- a/hs-bindgen/fixtures/manual/function_pointers.hs +++ b/hs-bindgen/fixtures/manual/function_pointers.hs @@ -33,7 +33,8 @@ nameHsIdent = Identifier "apply1Struct_apply1_nopointer_struct_field"}, fieldComment = Nothing}, - structFieldType = TypeConst + structFieldType = TypeQualified + TypeQualifierConst (TypePointer (TypeFun [ @@ -112,7 +113,8 @@ nameHsIdent = Identifier "apply1Struct_apply1_nopointer_struct_field"}, fieldComment = Nothing}, - structFieldType = TypeConst + structFieldType = TypeQualified + TypeQualifierConst (TypePointer (TypeFun [ @@ -196,7 +198,8 @@ nameHsIdent = Identifier "apply1Struct_apply1_nopointer_struct_field"}, fieldComment = Nothing}, - structFieldType = TypeConst + structFieldType = TypeQualified + TypeQualifierConst (TypePointer (TypeFun [ @@ -275,7 +278,8 @@ nameHsIdent = Identifier "apply1Struct_apply1_nopointer_struct_field"}, fieldComment = Nothing}, - structFieldType = TypeConst + structFieldType = TypeQualified + TypeQualifierConst (TypePointer (TypeFun [ @@ -363,7 +367,8 @@ nameHsIdent = Identifier "apply1Struct_apply1_nopointer_struct_field"}, fieldComment = Nothing}, - structFieldType = TypeConst + structFieldType = TypeQualified + TypeQualifierConst (TypePointer (TypeFun [ @@ -447,7 +452,8 @@ Identifier "apply1Struct_apply1_nopointer_struct_field"}, fieldComment = Nothing}, - structFieldType = TypeConst + structFieldType = TypeQualified + TypeQualifierConst (TypePointer (TypeFun [ @@ -535,7 +541,8 @@ nameHsIdent = Identifier "apply1Struct_apply1_nopointer_struct_field"}, fieldComment = Nothing}, - structFieldType = TypeConst + structFieldType = TypeQualified + TypeQualifierConst (TypePointer (TypeFun [ @@ -619,7 +626,8 @@ Identifier "apply1Struct_apply1_nopointer_struct_field"}, fieldComment = Nothing}, - structFieldType = TypeConst + structFieldType = TypeQualified + TypeQualifierConst (TypePointer (TypeFun [ @@ -758,7 +766,8 @@ nameHsIdent = Identifier "apply1Union_apply1_nopointer_union_field"}, fieldComment = Nothing}, - unionFieldType = TypeConst + unionFieldType = TypeQualified + TypeQualifierConst (TypePointer (TypeFun [ @@ -1374,7 +1383,8 @@ functionAttrs = FunctionAttributes ImpureFunction, - functionRes = TypeConst + functionRes = TypeQualified + TypeQualifierConst (TypePointer (TypeFun [ @@ -1905,7 +1915,8 @@ functionAttrs = FunctionAttributes ImpureFunction, - functionRes = TypeConst + functionRes = TypeQualified + TypeQualifierConst (TypePointer (TypeFun [ @@ -2240,7 +2251,8 @@ foreignImportOrigin = Global (TypeFun [] - (TypeConst + (TypeQualified + TypeQualifierConst (TypePointer (TypeFun [ @@ -2291,7 +2303,8 @@ capiWrapperImport = "manual/function_pointers.h"}, foreignImportOrigin = Global - (TypeConst + (TypeQualified + TypeQualifierConst (TypePointer (TypeFun [ @@ -2338,7 +2351,8 @@ capiWrapperImport = "manual/function_pointers.h"}, foreignImportOrigin = Global - (TypeConst + (TypeQualified + TypeQualifierConst (TypeStruct NamePair { nameC = Name "Apply1Struct", @@ -2375,7 +2389,8 @@ capiWrapperImport = "manual/function_pointers.h"}, foreignImportOrigin = Global - (TypeConst + (TypeQualified + TypeQualifierConst (TypeUnion NamePair { nameC = Name "Apply1Union", diff --git a/hs-bindgen/fixtures/manual/function_pointers.tree-diff.txt b/hs-bindgen/fixtures/manual/function_pointers.tree-diff.txt index 54c7419c2..fee2db2e2 100644 --- a/hs-bindgen/fixtures/manual/function_pointers.tree-diff.txt +++ b/hs-bindgen/fixtures/manual/function_pointers.tree-diff.txt @@ -332,7 +332,8 @@ TranslationUnit { functionAttrs = FunctionAttributes ImpureFunction, - functionRes = TypeConst + functionRes = TypeQualified + TypeQualifierConst (TypePointer (TypeFun [ @@ -382,7 +383,8 @@ TranslationUnit { TextContent "A global variable pointing to a function like apply1_nopointer()."]])}, declKind = DeclGlobal - (TypeConst + (TypeQualified + TypeQualifierConst (TypePointer (TypeFun [ @@ -449,7 +451,8 @@ TranslationUnit { nameHsIdent = Identifier "apply1Struct_apply1_nopointer_struct_field"}, fieldComment = Nothing}, - structFieldType = TypeConst + structFieldType = TypeQualified + TypeQualifierConst (TypePointer (TypeFun [ @@ -493,7 +496,8 @@ TranslationUnit { "manual/function_pointers.h"}, declComment = Nothing}, declKind = DeclGlobal - (TypeConst + (TypeQualified + TypeQualifierConst (TypeStruct NamePair { nameC = Name "Apply1Struct", @@ -553,7 +557,8 @@ TranslationUnit { nameHsIdent = Identifier "apply1Union_apply1_nopointer_union_field"}, fieldComment = Nothing}, - unionFieldType = TypeConst + unionFieldType = TypeQualified + TypeQualifierConst (TypePointer (TypeFun [ @@ -594,7 +599,8 @@ TranslationUnit { "manual/function_pointers.h"}, declComment = Nothing}, declKind = DeclGlobal - (TypeConst + (TypeQualified + TypeQualifierConst (TypeUnion NamePair { nameC = Name "Apply1Union", diff --git a/hs-bindgen/fixtures/program_slicing_simple.hs b/hs-bindgen/fixtures/program_slicing_simple.hs index 5e4d6e8c8..fc77779f1 100644 --- a/hs-bindgen/fixtures/program_slicing_simple.hs +++ b/hs-bindgen/fixtures/program_slicing_simple.hs @@ -465,7 +465,11 @@ NamePair { nameC = Name "uint32_t", nameHsIdent = Identifier - "Uint32_t"}), + "Uint32_t"} + (TypePrim + (PrimIntegral + PrimInt + Unsigned))), structFieldOffset = 64, structFieldWidth = Nothing}, fieldComment = Just @@ -629,7 +633,11 @@ NamePair { nameC = Name "uint32_t", nameHsIdent = Identifier - "Uint32_t"}), + "Uint32_t"} + (TypePrim + (PrimIntegral + PrimInt + Unsigned))), structFieldOffset = 64, structFieldWidth = Nothing}], structFlam = Nothing}, @@ -910,7 +918,11 @@ NamePair { nameC = Name "uint32_t", nameHsIdent = Identifier - "Uint32_t"}), + "Uint32_t"} + (TypePrim + (PrimIntegral + PrimInt + Unsigned))), structFieldOffset = 64, structFieldWidth = Nothing}, fieldComment = Just @@ -1074,7 +1086,11 @@ NamePair { nameC = Name "uint32_t", nameHsIdent = Identifier - "Uint32_t"}), + "Uint32_t"} + (TypePrim + (PrimIntegral + PrimInt + Unsigned))), structFieldOffset = 64, structFieldWidth = Nothing}], structFlam = Nothing}, @@ -1358,7 +1374,11 @@ NamePair { nameC = Name "uint32_t", nameHsIdent = Identifier - "Uint32_t"}), + "Uint32_t"} + (TypePrim + (PrimIntegral + PrimInt + Unsigned))), structFieldOffset = 64, structFieldWidth = Nothing}, fieldComment = Just @@ -1522,7 +1542,11 @@ NamePair { nameC = Name "uint32_t", nameHsIdent = Identifier - "Uint32_t"}), + "Uint32_t"} + (TypePrim + (PrimIntegral + PrimInt + Unsigned))), structFieldOffset = 64, structFieldWidth = Nothing}], structFlam = Nothing}, @@ -1808,7 +1832,11 @@ NamePair { nameC = Name "uint32_t", nameHsIdent = Identifier - "Uint32_t"}), + "Uint32_t"} + (TypePrim + (PrimIntegral + PrimInt + Unsigned))), structFieldOffset = 64, structFieldWidth = Nothing}, fieldComment = Just @@ -1972,7 +2000,11 @@ NamePair { nameC = Name "uint32_t", nameHsIdent = Identifier - "Uint32_t"}), + "Uint32_t"} + (TypePrim + (PrimIntegral + PrimInt + Unsigned))), structFieldOffset = 64, structFieldWidth = Nothing}], structFlam = Nothing}, diff --git a/hs-bindgen/fixtures/program_slicing_simple.tree-diff.txt b/hs-bindgen/fixtures/program_slicing_simple.tree-diff.txt index 15e5165cb..1382714e8 100644 --- a/hs-bindgen/fixtures/program_slicing_simple.tree-diff.txt +++ b/hs-bindgen/fixtures/program_slicing_simple.tree-diff.txt @@ -184,7 +184,11 @@ TranslationUnit { NamePair { nameC = Name "uint32_t", nameHsIdent = Identifier - "Uint32_t"}), + "Uint32_t"} + (TypePrim + (PrimIntegral + PrimInt + Unsigned))), structFieldOffset = 64, structFieldWidth = Nothing}], structFlam = Nothing}, diff --git a/hs-bindgen/fixtures/reparse.hs b/hs-bindgen/fixtures/reparse.hs index 165f46247..a3132f28d 100644 --- a/hs-bindgen/fixtures/reparse.hs +++ b/hs-bindgen/fixtures/reparse.hs @@ -1916,7 +1916,14 @@ nameC = Name "funptr_typedef1_Deref", nameHsIdent = Identifier - "Funptr_typedef1_Deref"}))}, + "Funptr_typedef1_Deref"} + (TypeFun + [] + (TypeMacroTypedef + NamePair { + nameC = Name "A", + nameHsIdent = Identifier "A"} + NameOriginInSource))))}, declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, @@ -2218,7 +2225,15 @@ nameC = Name "funptr_typedef2_Deref", nameHsIdent = Identifier - "Funptr_typedef2_Deref"}))}, + "Funptr_typedef2_Deref"} + (TypeFun + [] + (TypePointer + (TypeMacroTypedef + NamePair { + nameC = Name "A", + nameHsIdent = Identifier "A"} + NameOriginInSource)))))}, declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, @@ -2524,7 +2539,16 @@ nameC = Name "funptr_typedef3_Deref", nameHsIdent = Identifier - "Funptr_typedef3_Deref"}))}, + "Funptr_typedef3_Deref"} + (TypeFun + [] + (TypePointer + (TypePointer + (TypeMacroTypedef + NamePair { + nameC = Name "A", + nameHsIdent = Identifier "A"} + NameOriginInSource))))))}, declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, @@ -2838,7 +2862,18 @@ nameC = Name "funptr_typedef4_Deref", nameHsIdent = Identifier - "Funptr_typedef4_Deref"}))}, + "Funptr_typedef4_Deref"} + (TypeFun + [ + TypePrim + (PrimIntegral PrimInt Signed), + TypePrim + (PrimFloating PrimDouble)] + (TypeMacroTypedef + NamePair { + nameC = Name "A", + nameHsIdent = Identifier "A"} + NameOriginInSource))))}, declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, @@ -3156,7 +3191,19 @@ nameC = Name "funptr_typedef5_Deref", nameHsIdent = Identifier - "Funptr_typedef5_Deref"}))}, + "Funptr_typedef5_Deref"} + (TypeFun + [ + TypePrim + (PrimIntegral PrimInt Signed), + TypePrim + (PrimFloating PrimDouble)] + (TypePointer + (TypeMacroTypedef + NamePair { + nameC = Name "A", + nameHsIdent = Identifier "A"} + NameOriginInSource)))))}, declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, @@ -4397,7 +4444,8 @@ newtypeField = Name "@NsVar" "un_Const_typedef1"}, - typedefType = TypeConst + typedefType = TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -4608,7 +4656,8 @@ newtypeField = Name "@NsVar" "un_Const_typedef2"}, - typedefType = TypeConst + typedefType = TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -4821,7 +4870,8 @@ "@NsVar" "un_Const_typedef3"}, typedefType = TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -4930,7 +4980,8 @@ "@NsVar" "un_Const_typedef4"}, typedefType = TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -5038,7 +5089,8 @@ newtypeField = Name "@NsVar" "un_Const_typedef5"}, - typedefType = TypeConst + typedefType = TypeQualified + TypeQualifierConst (TypePointer (TypeMacroTypedef NamePair { @@ -5147,9 +5199,11 @@ newtypeField = Name "@NsVar" "un_Const_typedef6"}, - typedefType = TypeConst + typedefType = TypeQualified + TypeQualifierConst (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -5257,9 +5311,11 @@ newtypeField = Name "@NsVar" "un_Const_typedef7"}, - typedefType = TypeConst + typedefType = TypeQualified + TypeQualifierConst (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -5350,7 +5406,8 @@ nameHsIdent = Identifier "example_struct_with_const_const_field1"}, fieldComment = Nothing}, - structFieldType = TypeConst + structFieldType = TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -5386,7 +5443,8 @@ nameHsIdent = Identifier "example_struct_with_const_const_field2"}, fieldComment = Nothing}, - structFieldType = TypeConst + structFieldType = TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -5424,7 +5482,8 @@ "example_struct_with_const_const_field3"}, fieldComment = Nothing}, structFieldType = TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -5462,7 +5521,8 @@ "example_struct_with_const_const_field4"}, fieldComment = Nothing}, structFieldType = TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -5499,7 +5559,8 @@ nameHsIdent = Identifier "example_struct_with_const_const_field5"}, fieldComment = Nothing}, - structFieldType = TypeConst + structFieldType = TypeQualified + TypeQualifierConst (TypePointer (TypeMacroTypedef NamePair { @@ -5537,9 +5598,11 @@ nameHsIdent = Identifier "example_struct_with_const_const_field6"}, fieldComment = Nothing}, - structFieldType = TypeConst + structFieldType = TypeQualified + TypeQualifierConst (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -5576,9 +5639,11 @@ nameHsIdent = Identifier "example_struct_with_const_const_field7"}, fieldComment = Nothing}, - structFieldType = TypeConst + structFieldType = TypeQualified + TypeQualifierConst (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -5633,7 +5698,8 @@ nameHsIdent = Identifier "example_struct_with_const_const_field1"}, fieldComment = Nothing}, - structFieldType = TypeConst + structFieldType = TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -5649,7 +5715,8 @@ nameHsIdent = Identifier "example_struct_with_const_const_field2"}, fieldComment = Nothing}, - structFieldType = TypeConst + structFieldType = TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -5666,7 +5733,8 @@ "example_struct_with_const_const_field3"}, fieldComment = Nothing}, structFieldType = TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -5683,7 +5751,8 @@ "example_struct_with_const_const_field4"}, fieldComment = Nothing}, structFieldType = TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -5699,7 +5768,8 @@ nameHsIdent = Identifier "example_struct_with_const_const_field5"}, fieldComment = Nothing}, - structFieldType = TypeConst + structFieldType = TypeQualified + TypeQualifierConst (TypePointer (TypeMacroTypedef NamePair { @@ -5716,9 +5786,11 @@ nameHsIdent = Identifier "example_struct_with_const_const_field6"}, fieldComment = Nothing}, - structFieldType = TypeConst + structFieldType = TypeQualified + TypeQualifierConst (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -5734,9 +5806,11 @@ nameHsIdent = Identifier "example_struct_with_const_const_field7"}, fieldComment = Nothing}, - structFieldType = TypeConst + structFieldType = TypeQualified + TypeQualifierConst (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -5793,7 +5867,8 @@ nameHsIdent = Identifier "example_struct_with_const_const_field1"}, fieldComment = Nothing}, - structFieldType = TypeConst + structFieldType = TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -5829,7 +5904,8 @@ nameHsIdent = Identifier "example_struct_with_const_const_field2"}, fieldComment = Nothing}, - structFieldType = TypeConst + structFieldType = TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -5867,7 +5943,8 @@ "example_struct_with_const_const_field3"}, fieldComment = Nothing}, structFieldType = TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -5905,7 +5982,8 @@ "example_struct_with_const_const_field4"}, fieldComment = Nothing}, structFieldType = TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -5942,7 +6020,8 @@ nameHsIdent = Identifier "example_struct_with_const_const_field5"}, fieldComment = Nothing}, - structFieldType = TypeConst + structFieldType = TypeQualified + TypeQualifierConst (TypePointer (TypeMacroTypedef NamePair { @@ -5980,9 +6059,11 @@ nameHsIdent = Identifier "example_struct_with_const_const_field6"}, fieldComment = Nothing}, - structFieldType = TypeConst + structFieldType = TypeQualified + TypeQualifierConst (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -6019,9 +6100,11 @@ nameHsIdent = Identifier "example_struct_with_const_const_field7"}, fieldComment = Nothing}, - structFieldType = TypeConst + structFieldType = TypeQualified + TypeQualifierConst (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -6076,7 +6159,8 @@ nameHsIdent = Identifier "example_struct_with_const_const_field1"}, fieldComment = Nothing}, - structFieldType = TypeConst + structFieldType = TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -6092,7 +6176,8 @@ nameHsIdent = Identifier "example_struct_with_const_const_field2"}, fieldComment = Nothing}, - structFieldType = TypeConst + structFieldType = TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -6109,7 +6194,8 @@ "example_struct_with_const_const_field3"}, fieldComment = Nothing}, structFieldType = TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -6126,7 +6212,8 @@ "example_struct_with_const_const_field4"}, fieldComment = Nothing}, structFieldType = TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -6142,7 +6229,8 @@ nameHsIdent = Identifier "example_struct_with_const_const_field5"}, fieldComment = Nothing}, - structFieldType = TypeConst + structFieldType = TypeQualified + TypeQualifierConst (TypePointer (TypeMacroTypedef NamePair { @@ -6159,9 +6247,11 @@ nameHsIdent = Identifier "example_struct_with_const_const_field6"}, fieldComment = Nothing}, - structFieldType = TypeConst + structFieldType = TypeQualified + TypeQualifierConst (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -6177,9 +6267,11 @@ nameHsIdent = Identifier "example_struct_with_const_const_field7"}, fieldComment = Nothing}, - structFieldType = TypeConst + structFieldType = TypeQualified + TypeQualifierConst (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -6239,7 +6331,8 @@ nameHsIdent = Identifier "example_struct_with_const_const_field1"}, fieldComment = Nothing}, - structFieldType = TypeConst + structFieldType = TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -6275,7 +6368,8 @@ nameHsIdent = Identifier "example_struct_with_const_const_field2"}, fieldComment = Nothing}, - structFieldType = TypeConst + structFieldType = TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -6313,7 +6407,8 @@ "example_struct_with_const_const_field3"}, fieldComment = Nothing}, structFieldType = TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -6351,7 +6446,8 @@ "example_struct_with_const_const_field4"}, fieldComment = Nothing}, structFieldType = TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -6388,7 +6484,8 @@ nameHsIdent = Identifier "example_struct_with_const_const_field5"}, fieldComment = Nothing}, - structFieldType = TypeConst + structFieldType = TypeQualified + TypeQualifierConst (TypePointer (TypeMacroTypedef NamePair { @@ -6426,9 +6523,11 @@ nameHsIdent = Identifier "example_struct_with_const_const_field6"}, fieldComment = Nothing}, - structFieldType = TypeConst + structFieldType = TypeQualified + TypeQualifierConst (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -6465,9 +6564,11 @@ nameHsIdent = Identifier "example_struct_with_const_const_field7"}, fieldComment = Nothing}, - structFieldType = TypeConst + structFieldType = TypeQualified + TypeQualifierConst (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -6522,7 +6623,8 @@ nameHsIdent = Identifier "example_struct_with_const_const_field1"}, fieldComment = Nothing}, - structFieldType = TypeConst + structFieldType = TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -6538,7 +6640,8 @@ nameHsIdent = Identifier "example_struct_with_const_const_field2"}, fieldComment = Nothing}, - structFieldType = TypeConst + structFieldType = TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -6555,7 +6658,8 @@ "example_struct_with_const_const_field3"}, fieldComment = Nothing}, structFieldType = TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -6572,7 +6676,8 @@ "example_struct_with_const_const_field4"}, fieldComment = Nothing}, structFieldType = TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -6588,7 +6693,8 @@ nameHsIdent = Identifier "example_struct_with_const_const_field5"}, fieldComment = Nothing}, - structFieldType = TypeConst + structFieldType = TypeQualified + TypeQualifierConst (TypePointer (TypeMacroTypedef NamePair { @@ -6605,9 +6711,11 @@ nameHsIdent = Identifier "example_struct_with_const_const_field6"}, fieldComment = Nothing}, - structFieldType = TypeConst + structFieldType = TypeQualified + TypeQualifierConst (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -6623,9 +6731,11 @@ nameHsIdent = Identifier "example_struct_with_const_const_field7"}, fieldComment = Nothing}, - structFieldType = TypeConst + structFieldType = TypeQualified + TypeQualifierConst (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -6692,7 +6802,8 @@ nameHsIdent = Identifier "example_struct_with_const_const_field1"}, fieldComment = Nothing}, - structFieldType = TypeConst + structFieldType = TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -6728,7 +6839,8 @@ nameHsIdent = Identifier "example_struct_with_const_const_field2"}, fieldComment = Nothing}, - structFieldType = TypeConst + structFieldType = TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -6766,7 +6878,8 @@ "example_struct_with_const_const_field3"}, fieldComment = Nothing}, structFieldType = TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -6804,7 +6917,8 @@ "example_struct_with_const_const_field4"}, fieldComment = Nothing}, structFieldType = TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -6841,7 +6955,8 @@ nameHsIdent = Identifier "example_struct_with_const_const_field5"}, fieldComment = Nothing}, - structFieldType = TypeConst + structFieldType = TypeQualified + TypeQualifierConst (TypePointer (TypeMacroTypedef NamePair { @@ -6879,9 +6994,11 @@ nameHsIdent = Identifier "example_struct_with_const_const_field6"}, fieldComment = Nothing}, - structFieldType = TypeConst + structFieldType = TypeQualified + TypeQualifierConst (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -6918,9 +7035,11 @@ nameHsIdent = Identifier "example_struct_with_const_const_field7"}, fieldComment = Nothing}, - structFieldType = TypeConst + structFieldType = TypeQualified + TypeQualifierConst (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -6975,7 +7094,8 @@ nameHsIdent = Identifier "example_struct_with_const_const_field1"}, fieldComment = Nothing}, - structFieldType = TypeConst + structFieldType = TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -6991,7 +7111,8 @@ nameHsIdent = Identifier "example_struct_with_const_const_field2"}, fieldComment = Nothing}, - structFieldType = TypeConst + structFieldType = TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -7008,7 +7129,8 @@ "example_struct_with_const_const_field3"}, fieldComment = Nothing}, structFieldType = TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -7025,7 +7147,8 @@ "example_struct_with_const_const_field4"}, fieldComment = Nothing}, structFieldType = TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -7041,7 +7164,8 @@ nameHsIdent = Identifier "example_struct_with_const_const_field5"}, fieldComment = Nothing}, - structFieldType = TypeConst + structFieldType = TypeQualified + TypeQualifierConst (TypePointer (TypeMacroTypedef NamePair { @@ -7058,9 +7182,11 @@ nameHsIdent = Identifier "example_struct_with_const_const_field6"}, fieldComment = Nothing}, - structFieldType = TypeConst + structFieldType = TypeQualified + TypeQualifierConst (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -7076,9 +7202,11 @@ nameHsIdent = Identifier "example_struct_with_const_const_field7"}, fieldComment = Nothing}, - structFieldType = TypeConst + structFieldType = TypeQualified + TypeQualifierConst (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -7208,7 +7336,8 @@ (PrimIntegral PrimInt Signed), TypePrim (PrimFloating PrimDouble)] - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -7271,7 +7400,8 @@ (PrimIntegral PrimInt Signed), TypePrim (PrimFloating PrimDouble)] - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -7311,7 +7441,8 @@ (PrimIntegral PrimInt Signed), TypePrim (PrimFloating PrimDouble)] - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -7398,7 +7529,20 @@ nameC = Name "const_funptr1_Deref", nameHsIdent = Identifier - "Const_funptr1_Deref"}))}, + "Const_funptr1_Deref"} + (TypeFun + [ + TypePrim + (PrimIntegral PrimInt Signed), + TypePrim + (PrimFloating PrimDouble)] + (TypeQualified + TypeQualifierConst + (TypeMacroTypedef + NamePair { + nameC = Name "A", + nameHsIdent = Identifier "A"} + NameOriginInSource)))))}, declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, @@ -7525,7 +7669,8 @@ (PrimIntegral PrimInt Signed), TypePrim (PrimFloating PrimDouble)] - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -7588,7 +7733,8 @@ (PrimIntegral PrimInt Signed), TypePrim (PrimFloating PrimDouble)] - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -7628,7 +7774,8 @@ (PrimIntegral PrimInt Signed), TypePrim (PrimFloating PrimDouble)] - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -7715,7 +7862,20 @@ nameC = Name "const_funptr2_Deref", nameHsIdent = Identifier - "Const_funptr2_Deref"}))}, + "Const_funptr2_Deref"} + (TypeFun + [ + TypePrim + (PrimIntegral PrimInt Signed), + TypePrim + (PrimFloating PrimDouble)] + (TypeQualified + TypeQualifierConst + (TypeMacroTypedef + NamePair { + nameC = Name "A", + nameHsIdent = Identifier "A"} + NameOriginInSource)))))}, declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, @@ -7844,7 +8004,8 @@ TypePrim (PrimFloating PrimDouble)] (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -7908,7 +8069,8 @@ TypePrim (PrimFloating PrimDouble)] (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -7949,7 +8111,8 @@ TypePrim (PrimFloating PrimDouble)] (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -8036,7 +8199,21 @@ nameC = Name "const_funptr3_Deref", nameHsIdent = Identifier - "Const_funptr3_Deref"}))}, + "Const_funptr3_Deref"} + (TypeFun + [ + TypePrim + (PrimIntegral PrimInt Signed), + TypePrim + (PrimFloating PrimDouble)] + (TypePointer + (TypeQualified + TypeQualifierConst + (TypeMacroTypedef + NamePair { + nameC = Name "A", + nameHsIdent = Identifier "A"} + NameOriginInSource))))))}, declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, @@ -8165,7 +8342,8 @@ TypePrim (PrimFloating PrimDouble)] (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -8229,7 +8407,8 @@ TypePrim (PrimFloating PrimDouble)] (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -8270,7 +8449,8 @@ TypePrim (PrimFloating PrimDouble)] (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -8357,7 +8537,21 @@ nameC = Name "const_funptr4_Deref", nameHsIdent = Identifier - "Const_funptr4_Deref"}))}, + "Const_funptr4_Deref"} + (TypeFun + [ + TypePrim + (PrimIntegral PrimInt Signed), + TypePrim + (PrimFloating PrimDouble)] + (TypePointer + (TypeQualified + TypeQualifierConst + (TypeMacroTypedef + NamePair { + nameC = Name "A", + nameHsIdent = Identifier "A"} + NameOriginInSource))))))}, declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, @@ -8485,7 +8679,8 @@ (PrimIntegral PrimInt Signed), TypePrim (PrimFloating PrimDouble)] - (TypeConst + (TypeQualified + TypeQualifierConst (TypePointer (TypeMacroTypedef NamePair { @@ -8549,7 +8744,8 @@ (PrimIntegral PrimInt Signed), TypePrim (PrimFloating PrimDouble)] - (TypeConst + (TypeQualified + TypeQualifierConst (TypePointer (TypeMacroTypedef NamePair { @@ -8590,7 +8786,8 @@ (PrimIntegral PrimInt Signed), TypePrim (PrimFloating PrimDouble)] - (TypeConst + (TypeQualified + TypeQualifierConst (TypePointer (TypeMacroTypedef NamePair { @@ -8678,7 +8875,21 @@ nameC = Name "const_funptr5_Deref", nameHsIdent = Identifier - "Const_funptr5_Deref"}))}, + "Const_funptr5_Deref"} + (TypeFun + [ + TypePrim + (PrimIntegral PrimInt Signed), + TypePrim + (PrimFloating PrimDouble)] + (TypeQualified + TypeQualifierConst + (TypePointer + (TypeMacroTypedef + NamePair { + nameC = Name "A", + nameHsIdent = Identifier "A"} + NameOriginInSource))))))}, declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, @@ -8806,9 +9017,11 @@ (PrimIntegral PrimInt Signed), TypePrim (PrimFloating PrimDouble)] - (TypeConst + (TypeQualified + TypeQualifierConst (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -8871,9 +9084,11 @@ (PrimIntegral PrimInt Signed), TypePrim (PrimFloating PrimDouble)] - (TypeConst + (TypeQualified + TypeQualifierConst (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -8913,9 +9128,11 @@ (PrimIntegral PrimInt Signed), TypePrim (PrimFloating PrimDouble)] - (TypeConst + (TypeQualified + TypeQualifierConst (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -9002,7 +9219,23 @@ nameC = Name "const_funptr6_Deref", nameHsIdent = Identifier - "Const_funptr6_Deref"}))}, + "Const_funptr6_Deref"} + (TypeFun + [ + TypePrim + (PrimIntegral PrimInt Signed), + TypePrim + (PrimFloating PrimDouble)] + (TypeQualified + TypeQualifierConst + (TypePointer + (TypeQualified + TypeQualifierConst + (TypeMacroTypedef + NamePair { + nameC = Name "A", + nameHsIdent = Identifier "A"} + NameOriginInSource)))))))}, declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, @@ -9130,9 +9363,11 @@ (PrimIntegral PrimInt Signed), TypePrim (PrimFloating PrimDouble)] - (TypeConst + (TypeQualified + TypeQualifierConst (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -9195,9 +9430,11 @@ (PrimIntegral PrimInt Signed), TypePrim (PrimFloating PrimDouble)] - (TypeConst + (TypeQualified + TypeQualifierConst (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -9237,9 +9474,11 @@ (PrimIntegral PrimInt Signed), TypePrim (PrimFloating PrimDouble)] - (TypeConst + (TypeQualified + TypeQualifierConst (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -9326,7 +9565,23 @@ nameC = Name "const_funptr7_Deref", nameHsIdent = Identifier - "Const_funptr7_Deref"}))}, + "Const_funptr7_Deref"} + (TypeFun + [ + TypePrim + (PrimIntegral PrimInt Signed), + TypePrim + (PrimFloating PrimDouble)] + (TypeQualified + TypeQualifierConst + (TypePointer + (TypeQualified + TypeQualifierConst + (TypeMacroTypedef + NamePair { + nameC = Name "A", + nameHsIdent = Identifier "A"} + NameOriginInSource)))))))}, declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, @@ -9941,9 +10196,11 @@ newtypeField = Name "@NsVar" "un_INTCP"}, - macroType = TypeConst + macroType = TypeQualified + TypeQualifierConst (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt @@ -14740,7 +14997,8 @@ nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimChar (PrimSignImplicit Nothing))))], @@ -14833,7 +15091,8 @@ nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimChar (PrimSignExplicit Signed))))], @@ -14917,7 +15176,8 @@ nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimChar (PrimSignExplicit Unsigned))))], @@ -15001,7 +15261,8 @@ nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimChar (PrimSignImplicit Nothing))))], @@ -15085,7 +15346,8 @@ nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimChar (PrimSignExplicit Signed))))], @@ -15169,7 +15431,8 @@ nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimChar (PrimSignExplicit Unsigned))))], @@ -15253,7 +15516,8 @@ nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimFloating PrimFloat)))], functionAttrs = @@ -15336,7 +15600,8 @@ nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimFloating PrimDouble)))], functionAttrs = @@ -15419,7 +15684,8 @@ nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim PrimBool))], functionAttrs = FunctionAttributes @@ -15503,7 +15769,8 @@ nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypeStruct NamePair { nameC = Name "some_struct", @@ -15592,7 +15859,8 @@ nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypeUnion NamePair { nameC = Name "some_union", @@ -15681,7 +15949,8 @@ nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypeEnum NamePair { nameC = Name "some_enum", @@ -15768,7 +16037,8 @@ nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim PrimBool))], functionAttrs = FunctionAttributes @@ -15850,7 +16120,8 @@ nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim PrimSize))], functionAttrs = FunctionAttributes @@ -15932,7 +16203,8 @@ nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimFloating PrimFloat)))], functionAttrs = @@ -16015,7 +16287,8 @@ nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimFloating PrimDouble)))], functionAttrs = @@ -16098,7 +16371,8 @@ nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim PrimBool))], functionAttrs = FunctionAttributes @@ -16182,7 +16456,8 @@ nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypeStruct NamePair { nameC = Name "some_struct", @@ -16271,7 +16546,8 @@ nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypeUnion NamePair { nameC = Name "some_union", @@ -16360,7 +16636,8 @@ nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypeEnum NamePair { nameC = Name "some_enum", @@ -16447,7 +16724,8 @@ nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim PrimBool))], functionAttrs = FunctionAttributes @@ -16529,7 +16807,8 @@ nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim PrimSize))], functionAttrs = FunctionAttributes @@ -16612,7 +16891,8 @@ nameHsIdent = Identifier "arg2"}) (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt @@ -16698,7 +16978,8 @@ nameHsIdent = Identifier "arg2"}) (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt @@ -16783,7 +17064,8 @@ nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypePointer (TypePrim (PrimIntegral @@ -16869,9 +17151,11 @@ nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt @@ -16956,9 +17240,11 @@ nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt @@ -17031,7 +17317,8 @@ FunctionAttributes ImpureFunction, functionRes = TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt @@ -17100,7 +17387,8 @@ FunctionAttributes ImpureFunction, functionRes = TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt @@ -17168,7 +17456,8 @@ functionAttrs = FunctionAttributes ImpureFunction, - functionRes = TypeConst + functionRes = TypeQualified + TypeQualifierConst (TypePointer (TypePrim (PrimIntegral @@ -17237,9 +17526,11 @@ functionAttrs = FunctionAttributes ImpureFunction, - functionRes = TypeConst + functionRes = TypeQualified + TypeQualifierConst (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt @@ -17307,9 +17598,11 @@ functionAttrs = FunctionAttributes ImpureFunction, - functionRes = TypeConst + functionRes = TypeQualified + TypeQualifierConst (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt @@ -17369,7 +17662,8 @@ nameHsIdent = Identifier "arg1"}) (TypeIncompleteArray - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -17437,7 +17731,8 @@ "arg1"}) (TypeIncompleteArray (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -17504,7 +17799,8 @@ nameHsIdent = Identifier "arg1"}) (TypeIncompleteArray - (TypeConst + (TypeQualified + TypeQualifierConst (TypePointer (TypeMacroTypedef NamePair { @@ -18141,7 +18437,8 @@ TypePrim (PrimFloating PrimDouble)] (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt @@ -18223,7 +18520,8 @@ TypePrim (PrimFloating PrimDouble)] (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt @@ -18304,7 +18602,8 @@ (PrimIntegral PrimInt Signed), TypePrim (PrimFloating PrimDouble)] - (TypeConst + (TypeQualified + TypeQualifierConst (TypePointer (TypePrim (PrimIntegral @@ -18386,9 +18685,11 @@ (PrimIntegral PrimInt Signed), TypePrim (PrimFloating PrimDouble)] - (TypeConst + (TypeQualified + TypeQualifierConst (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt @@ -18469,9 +18770,11 @@ (PrimIntegral PrimInt Signed), TypePrim (PrimFloating PrimDouble)] - (TypeConst + (TypeQualified + TypeQualifierConst (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt @@ -23222,7 +23525,8 @@ nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimChar (PrimSignImplicit Nothing))))], @@ -23315,7 +23619,8 @@ nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimChar (PrimSignExplicit Signed))))], @@ -23399,7 +23704,8 @@ nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimChar (PrimSignExplicit Unsigned))))], @@ -23483,7 +23789,8 @@ nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimChar (PrimSignImplicit Nothing))))], @@ -23567,7 +23874,8 @@ nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimChar (PrimSignExplicit Signed))))], @@ -23651,7 +23959,8 @@ nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimChar (PrimSignExplicit Unsigned))))], @@ -23735,7 +24044,8 @@ nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimFloating PrimFloat)))], functionAttrs = @@ -23818,7 +24128,8 @@ nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimFloating PrimDouble)))], functionAttrs = @@ -23901,7 +24212,8 @@ nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim PrimBool))], functionAttrs = FunctionAttributes @@ -23985,7 +24297,8 @@ nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypeStruct NamePair { nameC = Name "some_struct", @@ -24074,7 +24387,8 @@ nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypeUnion NamePair { nameC = Name "some_union", @@ -24163,7 +24477,8 @@ nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypeEnum NamePair { nameC = Name "some_enum", @@ -24250,7 +24565,8 @@ nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim PrimBool))], functionAttrs = FunctionAttributes @@ -24332,7 +24648,8 @@ nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim PrimSize))], functionAttrs = FunctionAttributes @@ -24414,7 +24731,8 @@ nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimFloating PrimFloat)))], functionAttrs = @@ -24497,7 +24815,8 @@ nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimFloating PrimDouble)))], functionAttrs = @@ -24580,7 +24899,8 @@ nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim PrimBool))], functionAttrs = FunctionAttributes @@ -24664,7 +24984,8 @@ nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypeStruct NamePair { nameC = Name "some_struct", @@ -24753,7 +25074,8 @@ nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypeUnion NamePair { nameC = Name "some_union", @@ -24842,7 +25164,8 @@ nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypeEnum NamePair { nameC = Name "some_enum", @@ -24929,7 +25252,8 @@ nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim PrimBool))], functionAttrs = FunctionAttributes @@ -25011,7 +25335,8 @@ nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim PrimSize))], functionAttrs = FunctionAttributes @@ -25094,7 +25419,8 @@ nameHsIdent = Identifier "arg2"}) (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt @@ -25180,7 +25506,8 @@ nameHsIdent = Identifier "arg2"}) (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt @@ -25265,7 +25592,8 @@ nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypePointer (TypePrim (PrimIntegral @@ -25351,9 +25679,11 @@ nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt @@ -25438,9 +25768,11 @@ nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt @@ -25513,7 +25845,8 @@ FunctionAttributes ImpureFunction, functionRes = TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt @@ -25582,7 +25915,8 @@ FunctionAttributes ImpureFunction, functionRes = TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt @@ -25650,7 +25984,8 @@ functionAttrs = FunctionAttributes ImpureFunction, - functionRes = TypeConst + functionRes = TypeQualified + TypeQualifierConst (TypePointer (TypePrim (PrimIntegral @@ -25719,9 +26054,11 @@ functionAttrs = FunctionAttributes ImpureFunction, - functionRes = TypeConst + functionRes = TypeQualified + TypeQualifierConst (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt @@ -25789,9 +26126,11 @@ functionAttrs = FunctionAttributes ImpureFunction, - functionRes = TypeConst + functionRes = TypeQualified + TypeQualifierConst (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt @@ -25851,7 +26190,8 @@ nameHsIdent = Identifier "arg1"}) (TypeIncompleteArray - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -25919,7 +26259,8 @@ "arg1"}) (TypeIncompleteArray (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -25986,7 +26327,8 @@ nameHsIdent = Identifier "arg1"}) (TypeIncompleteArray - (TypeConst + (TypeQualified + TypeQualifierConst (TypePointer (TypeMacroTypedef NamePair { @@ -26623,7 +26965,8 @@ TypePrim (PrimFloating PrimDouble)] (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt @@ -26705,7 +27048,8 @@ TypePrim (PrimFloating PrimDouble)] (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt @@ -26786,7 +27130,8 @@ (PrimIntegral PrimInt Signed), TypePrim (PrimFloating PrimDouble)] - (TypeConst + (TypeQualified + TypeQualifierConst (TypePointer (TypePrim (PrimIntegral @@ -26868,9 +27213,11 @@ (PrimIntegral PrimInt Signed), TypePrim (PrimFloating PrimDouble)] - (TypeConst + (TypeQualified + TypeQualifierConst (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt @@ -26951,9 +27298,11 @@ (PrimIntegral PrimInt Signed), TypePrim (PrimFloating PrimDouble)] - (TypeConst + (TypeQualified + TypeQualifierConst (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt @@ -29611,7 +29960,8 @@ nameC = Name "A", nameHsIdent = Identifier "A"} NameOriginInSource, - TypeConst + TypeQualified + TypeQualifierConst (TypePrim (PrimChar (PrimSignImplicit Nothing)))] @@ -29654,7 +30004,8 @@ nameC = Name "A", nameHsIdent = Identifier "A"} NameOriginInSource, - TypeConst + TypeQualified + TypeQualifierConst (TypePrim (PrimChar (PrimSignExplicit Signed)))] @@ -29697,7 +30048,8 @@ nameC = Name "A", nameHsIdent = Identifier "A"} NameOriginInSource, - TypeConst + TypeQualified + TypeQualifierConst (TypePrim (PrimChar (PrimSignExplicit Unsigned)))] @@ -29740,7 +30092,8 @@ nameC = Name "A", nameHsIdent = Identifier "A"} NameOriginInSource, - TypeConst + TypeQualified + TypeQualifierConst (TypePrim (PrimChar (PrimSignImplicit Nothing)))] @@ -29783,7 +30136,8 @@ nameC = Name "A", nameHsIdent = Identifier "A"} NameOriginInSource, - TypeConst + TypeQualified + TypeQualifierConst (TypePrim (PrimChar (PrimSignExplicit Signed)))] @@ -29826,7 +30180,8 @@ nameC = Name "A", nameHsIdent = Identifier "A"} NameOriginInSource, - TypeConst + TypeQualified + TypeQualifierConst (TypePrim (PrimChar (PrimSignExplicit Unsigned)))] @@ -29869,7 +30224,8 @@ nameC = Name "A", nameHsIdent = Identifier "A"} NameOriginInSource, - TypeConst + TypeQualified + TypeQualifierConst (TypePrim (PrimFloating PrimFloat))] TypeVoid), @@ -29911,7 +30267,8 @@ nameC = Name "A", nameHsIdent = Identifier "A"} NameOriginInSource, - TypeConst + TypeQualified + TypeQualifierConst (TypePrim (PrimFloating PrimDouble))] TypeVoid), @@ -29953,7 +30310,9 @@ nameC = Name "A", nameHsIdent = Identifier "A"} NameOriginInSource, - TypeConst (TypePrim PrimBool)] + TypeQualified + TypeQualifierConst + (TypePrim PrimBool)] TypeVoid), foreignImportComment = Nothing, foreignImportSafety = Unsafe}, @@ -29996,7 +30355,8 @@ nameC = Name "A", nameHsIdent = Identifier "A"} NameOriginInSource, - TypeConst + TypeQualified + TypeQualifierConst (TypeStruct NamePair { nameC = Name "some_struct", @@ -30045,7 +30405,8 @@ nameC = Name "A", nameHsIdent = Identifier "A"} NameOriginInSource, - TypeConst + TypeQualified + TypeQualifierConst (TypeUnion NamePair { nameC = Name "some_union", @@ -30094,7 +30455,8 @@ nameC = Name "A", nameHsIdent = Identifier "A"} NameOriginInSource, - TypeConst + TypeQualified + TypeQualifierConst (TypeEnum NamePair { nameC = Name "some_enum", @@ -30140,7 +30502,9 @@ nameC = Name "A", nameHsIdent = Identifier "A"} NameOriginInSource, - TypeConst (TypePrim PrimBool)] + TypeQualified + TypeQualifierConst + (TypePrim PrimBool)] TypeVoid), foreignImportComment = Nothing, foreignImportSafety = Unsafe}, @@ -30180,7 +30544,9 @@ nameC = Name "A", nameHsIdent = Identifier "A"} NameOriginInSource, - TypeConst (TypePrim PrimSize)] + TypeQualified + TypeQualifierConst + (TypePrim PrimSize)] TypeVoid), foreignImportComment = Nothing, foreignImportSafety = Unsafe}, @@ -30220,7 +30586,8 @@ nameC = Name "A", nameHsIdent = Identifier "A"} NameOriginInSource, - TypeConst + TypeQualified + TypeQualifierConst (TypePrim (PrimFloating PrimFloat))] TypeVoid), @@ -30262,7 +30629,8 @@ nameC = Name "A", nameHsIdent = Identifier "A"} NameOriginInSource, - TypeConst + TypeQualified + TypeQualifierConst (TypePrim (PrimFloating PrimDouble))] TypeVoid), @@ -30304,7 +30672,9 @@ nameC = Name "A", nameHsIdent = Identifier "A"} NameOriginInSource, - TypeConst (TypePrim PrimBool)] + TypeQualified + TypeQualifierConst + (TypePrim PrimBool)] TypeVoid), foreignImportComment = Nothing, foreignImportSafety = Unsafe}, @@ -30347,7 +30717,8 @@ nameC = Name "A", nameHsIdent = Identifier "A"} NameOriginInSource, - TypeConst + TypeQualified + TypeQualifierConst (TypeStruct NamePair { nameC = Name "some_struct", @@ -30396,7 +30767,8 @@ nameC = Name "A", nameHsIdent = Identifier "A"} NameOriginInSource, - TypeConst + TypeQualified + TypeQualifierConst (TypeUnion NamePair { nameC = Name "some_union", @@ -30445,7 +30817,8 @@ nameC = Name "A", nameHsIdent = Identifier "A"} NameOriginInSource, - TypeConst + TypeQualified + TypeQualifierConst (TypeEnum NamePair { nameC = Name "some_enum", @@ -30491,7 +30864,9 @@ nameC = Name "A", nameHsIdent = Identifier "A"} NameOriginInSource, - TypeConst (TypePrim PrimBool)] + TypeQualified + TypeQualifierConst + (TypePrim PrimBool)] TypeVoid), foreignImportComment = Nothing, foreignImportSafety = Unsafe}, @@ -30531,7 +30906,9 @@ nameC = Name "A", nameHsIdent = Identifier "A"} NameOriginInSource, - TypeConst (TypePrim PrimSize)] + TypeQualified + TypeQualifierConst + (TypePrim PrimSize)] TypeVoid), foreignImportComment = Nothing, foreignImportSafety = Unsafe}, @@ -30572,7 +30949,8 @@ nameHsIdent = Identifier "A"} NameOriginInSource, TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt Signed)))] TypeVoid), @@ -30615,7 +30993,8 @@ nameHsIdent = Identifier "A"} NameOriginInSource, TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt Signed)))] TypeVoid), @@ -30657,7 +31036,8 @@ nameC = Name "A", nameHsIdent = Identifier "A"} NameOriginInSource, - TypeConst + TypeQualified + TypeQualifierConst (TypePointer (TypePrim (PrimIntegral PrimInt Signed)))] @@ -30700,9 +31080,11 @@ nameC = Name "A", nameHsIdent = Identifier "A"} NameOriginInSource, - TypeConst + TypeQualified + TypeQualifierConst (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt @@ -30746,9 +31128,11 @@ nameC = Name "A", nameHsIdent = Identifier "A"} NameOriginInSource, - TypeConst + TypeQualified + TypeQualifierConst (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt @@ -30792,7 +31176,8 @@ nameHsIdent = Identifier "A"} NameOriginInSource] (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt @@ -30835,7 +31220,8 @@ nameHsIdent = Identifier "A"} NameOriginInSource] (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt @@ -30877,7 +31263,8 @@ nameC = Name "A", nameHsIdent = Identifier "A"} NameOriginInSource] - (TypeConst + (TypeQualified + TypeQualifierConst (TypePointer (TypePrim (PrimIntegral @@ -30920,9 +31307,11 @@ nameC = Name "A", nameHsIdent = Identifier "A"} NameOriginInSource] - (TypeConst + (TypeQualified + TypeQualifierConst (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt @@ -30964,9 +31353,11 @@ nameC = Name "A", nameHsIdent = Identifier "A"} NameOriginInSource] - (TypeConst + (TypeQualified + TypeQualifierConst (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt @@ -31004,7 +31395,8 @@ (TypeFun [ TypeIncompleteArray - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -31046,7 +31438,8 @@ [ TypeIncompleteArray (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -31087,7 +31480,8 @@ (TypeFun [ TypeIncompleteArray - (TypeConst + (TypeQualified + TypeQualifierConst (TypePointer (TypeMacroTypedef NamePair { @@ -31500,7 +31894,8 @@ TypePrim (PrimFloating PrimDouble)] (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt @@ -31557,7 +31952,8 @@ TypePrim (PrimFloating PrimDouble)] (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt @@ -31613,7 +32009,8 @@ (PrimIntegral PrimInt Signed), TypePrim (PrimFloating PrimDouble)] - (TypeConst + (TypeQualified + TypeQualifierConst (TypePointer (TypePrim (PrimIntegral @@ -31670,9 +32067,11 @@ (PrimIntegral PrimInt Signed), TypePrim (PrimFloating PrimDouble)] - (TypeConst + (TypeQualified + TypeQualifierConst (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt @@ -31728,9 +32127,11 @@ (PrimIntegral PrimInt Signed), TypePrim (PrimFloating PrimDouble)] - (TypeConst + (TypeQualified + TypeQualifierConst (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt diff --git a/hs-bindgen/fixtures/reparse.tree-diff.txt b/hs-bindgen/fixtures/reparse.tree-diff.txt index f0bc3cda3..a30ded8a4 100644 --- a/hs-bindgen/fixtures/reparse.tree-diff.txt +++ b/hs-bindgen/fixtures/reparse.tree-diff.txt @@ -3272,7 +3272,14 @@ TranslationUnit { nameC = Name "funptr_typedef1_Deref", nameHsIdent = Identifier - "Funptr_typedef1_Deref"}))}, + "Funptr_typedef1_Deref"} + (TypeFun + [] + (TypeMacroTypedef + NamePair { + nameC = Name "A", + nameHsIdent = Identifier "A"} + NameOriginInSource))))}, declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, @@ -3362,7 +3369,15 @@ TranslationUnit { nameC = Name "funptr_typedef2_Deref", nameHsIdent = Identifier - "Funptr_typedef2_Deref"}))}, + "Funptr_typedef2_Deref"} + (TypeFun + [] + (TypePointer + (TypeMacroTypedef + NamePair { + nameC = Name "A", + nameHsIdent = Identifier "A"} + NameOriginInSource)))))}, declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, @@ -3453,7 +3468,16 @@ TranslationUnit { nameC = Name "funptr_typedef3_Deref", nameHsIdent = Identifier - "Funptr_typedef3_Deref"}))}, + "Funptr_typedef3_Deref"} + (TypeFun + [] + (TypePointer + (TypePointer + (TypeMacroTypedef + NamePair { + nameC = Name "A", + nameHsIdent = Identifier "A"} + NameOriginInSource))))))}, declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, @@ -3546,7 +3570,18 @@ TranslationUnit { nameC = Name "funptr_typedef4_Deref", nameHsIdent = Identifier - "Funptr_typedef4_Deref"}))}, + "Funptr_typedef4_Deref"} + (TypeFun + [ + TypePrim + (PrimIntegral PrimInt Signed), + TypePrim + (PrimFloating PrimDouble)] + (TypeMacroTypedef + NamePair { + nameC = Name "A", + nameHsIdent = Identifier "A"} + NameOriginInSource))))}, declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, @@ -3640,7 +3675,19 @@ TranslationUnit { nameC = Name "funptr_typedef5_Deref", nameHsIdent = Identifier - "Funptr_typedef5_Deref"}))}, + "Funptr_typedef5_Deref"} + (TypeFun + [ + TypePrim + (PrimIntegral PrimInt Signed), + TypePrim + (PrimFloating PrimDouble)] + (TypePointer + (TypeMacroTypedef + NamePair { + nameC = Name "A", + nameHsIdent = Identifier "A"} + NameOriginInSource)))))}, declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, @@ -3864,7 +3911,8 @@ TranslationUnit { nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimChar (PrimSignImplicit Nothing))))], @@ -3914,7 +3962,8 @@ TranslationUnit { nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimChar (PrimSignExplicit Signed))))], @@ -3964,7 +4013,8 @@ TranslationUnit { nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimChar (PrimSignExplicit Unsigned))))], @@ -4014,7 +4064,8 @@ TranslationUnit { nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimChar (PrimSignImplicit Nothing))))], @@ -4064,7 +4115,8 @@ TranslationUnit { nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimChar (PrimSignExplicit Signed))))], @@ -4114,7 +4166,8 @@ TranslationUnit { nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimChar (PrimSignExplicit Unsigned))))], @@ -4164,7 +4217,8 @@ TranslationUnit { nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimFloating PrimFloat)))], functionAttrs = @@ -4213,7 +4267,8 @@ TranslationUnit { nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimFloating PrimDouble)))], functionAttrs = @@ -4262,7 +4317,8 @@ TranslationUnit { nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim PrimBool))], functionAttrs = FunctionAttributes @@ -4310,7 +4366,8 @@ TranslationUnit { nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypeStruct NamePair { nameC = Name "some_struct", @@ -4363,7 +4420,8 @@ TranslationUnit { nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypeUnion NamePair { nameC = Name "some_union", @@ -4416,7 +4474,8 @@ TranslationUnit { nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypeEnum NamePair { nameC = Name "some_enum", @@ -4469,7 +4528,8 @@ TranslationUnit { nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim PrimBool))], functionAttrs = FunctionAttributes @@ -4517,7 +4577,8 @@ TranslationUnit { nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim PrimSize))], functionAttrs = FunctionAttributes @@ -4565,7 +4626,8 @@ TranslationUnit { nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimFloating PrimFloat)))], functionAttrs = @@ -4614,7 +4676,8 @@ TranslationUnit { nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimFloating PrimDouble)))], functionAttrs = @@ -4663,7 +4726,8 @@ TranslationUnit { nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim PrimBool))], functionAttrs = FunctionAttributes @@ -4711,7 +4775,8 @@ TranslationUnit { nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypeStruct NamePair { nameC = Name "some_struct", @@ -4764,7 +4829,8 @@ TranslationUnit { nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypeUnion NamePair { nameC = Name "some_union", @@ -4817,7 +4883,8 @@ TranslationUnit { nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypeEnum NamePair { nameC = Name "some_enum", @@ -4870,7 +4937,8 @@ TranslationUnit { nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim PrimBool))], functionAttrs = FunctionAttributes @@ -4918,7 +4986,8 @@ TranslationUnit { nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim PrimSize))], functionAttrs = FunctionAttributes @@ -4967,7 +5036,8 @@ TranslationUnit { nameHsIdent = Identifier "arg2"}) (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt @@ -5019,7 +5089,8 @@ TranslationUnit { nameHsIdent = Identifier "arg2"}) (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt @@ -5070,7 +5141,8 @@ TranslationUnit { nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypePointer (TypePrim (PrimIntegral @@ -5122,9 +5194,11 @@ TranslationUnit { nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt @@ -5175,9 +5249,11 @@ TranslationUnit { nameC = Name "arg2", nameHsIdent = Identifier "arg2"}) - (TypeConst + (TypeQualified + TypeQualifierConst (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt @@ -5226,7 +5302,8 @@ TranslationUnit { FunctionAttributes ImpureFunction, functionRes = TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt @@ -5271,7 +5348,8 @@ TranslationUnit { FunctionAttributes ImpureFunction, functionRes = TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt @@ -5315,7 +5393,8 @@ TranslationUnit { functionAttrs = FunctionAttributes ImpureFunction, - functionRes = TypeConst + functionRes = TypeQualified + TypeQualifierConst (TypePointer (TypePrim (PrimIntegral @@ -5360,9 +5439,11 @@ TranslationUnit { functionAttrs = FunctionAttributes ImpureFunction, - functionRes = TypeConst + functionRes = TypeQualified + TypeQualifierConst (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt @@ -5406,9 +5487,11 @@ TranslationUnit { functionAttrs = FunctionAttributes ImpureFunction, - functionRes = TypeConst + functionRes = TypeQualified + TypeQualifierConst (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt @@ -5443,7 +5526,8 @@ TranslationUnit { newtypeField = Name "@NsVar" "un_Const_typedef1"}, - typedefType = TypeConst + typedefType = TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -5479,7 +5563,8 @@ TranslationUnit { newtypeField = Name "@NsVar" "un_Const_typedef2"}, - typedefType = TypeConst + typedefType = TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -5516,7 +5601,8 @@ TranslationUnit { "@NsVar" "un_Const_typedef3"}, typedefType = TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -5553,7 +5639,8 @@ TranslationUnit { "@NsVar" "un_Const_typedef4"}, typedefType = TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -5589,7 +5676,8 @@ TranslationUnit { newtypeField = Name "@NsVar" "un_Const_typedef5"}, - typedefType = TypeConst + typedefType = TypeQualified + TypeQualifierConst (TypePointer (TypeMacroTypedef NamePair { @@ -5626,9 +5714,11 @@ TranslationUnit { newtypeField = Name "@NsVar" "un_Const_typedef6"}, - typedefType = TypeConst + typedefType = TypeQualified + TypeQualifierConst (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -5664,9 +5754,11 @@ TranslationUnit { newtypeField = Name "@NsVar" "un_Const_typedef7"}, - typedefType = TypeConst + typedefType = TypeQualified + TypeQualifierConst (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -5711,7 +5803,8 @@ TranslationUnit { nameHsIdent = Identifier "example_struct_with_const_const_field1"}, fieldComment = Nothing}, - structFieldType = TypeConst + structFieldType = TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -5727,7 +5820,8 @@ TranslationUnit { nameHsIdent = Identifier "example_struct_with_const_const_field2"}, fieldComment = Nothing}, - structFieldType = TypeConst + structFieldType = TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -5744,7 +5838,8 @@ TranslationUnit { "example_struct_with_const_const_field3"}, fieldComment = Nothing}, structFieldType = TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -5761,7 +5856,8 @@ TranslationUnit { "example_struct_with_const_const_field4"}, fieldComment = Nothing}, structFieldType = TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -5777,7 +5873,8 @@ TranslationUnit { nameHsIdent = Identifier "example_struct_with_const_const_field5"}, fieldComment = Nothing}, - structFieldType = TypeConst + structFieldType = TypeQualified + TypeQualifierConst (TypePointer (TypeMacroTypedef NamePair { @@ -5794,9 +5891,11 @@ TranslationUnit { nameHsIdent = Identifier "example_struct_with_const_const_field6"}, fieldComment = Nothing}, - structFieldType = TypeConst + structFieldType = TypeQualified + TypeQualifierConst (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -5812,9 +5911,11 @@ TranslationUnit { nameHsIdent = Identifier "example_struct_with_const_const_field7"}, fieldComment = Nothing}, - structFieldType = TypeConst + structFieldType = TypeQualified + TypeQualifierConst (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -5873,7 +5974,8 @@ TranslationUnit { (PrimIntegral PrimInt Signed), TypePrim (PrimFloating PrimDouble)] - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -5916,7 +6018,20 @@ TranslationUnit { nameC = Name "const_funptr1_Deref", nameHsIdent = Identifier - "Const_funptr1_Deref"}))}, + "Const_funptr1_Deref"} + (TypeFun + [ + TypePrim + (PrimIntegral PrimInt Signed), + TypePrim + (PrimFloating PrimDouble)] + (TypeQualified + TypeQualifierConst + (TypeMacroTypedef + NamePair { + nameC = Name "A", + nameHsIdent = Identifier "A"} + NameOriginInSource)))))}, declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, @@ -5967,7 +6082,8 @@ TranslationUnit { (PrimIntegral PrimInt Signed), TypePrim (PrimFloating PrimDouble)] - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -6010,7 +6126,20 @@ TranslationUnit { nameC = Name "const_funptr2_Deref", nameHsIdent = Identifier - "Const_funptr2_Deref"}))}, + "Const_funptr2_Deref"} + (TypeFun + [ + TypePrim + (PrimIntegral PrimInt Signed), + TypePrim + (PrimFloating PrimDouble)] + (TypeQualified + TypeQualifierConst + (TypeMacroTypedef + NamePair { + nameC = Name "A", + nameHsIdent = Identifier "A"} + NameOriginInSource)))))}, declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, @@ -6062,7 +6191,8 @@ TranslationUnit { TypePrim (PrimFloating PrimDouble)] (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -6105,7 +6235,21 @@ TranslationUnit { nameC = Name "const_funptr3_Deref", nameHsIdent = Identifier - "Const_funptr3_Deref"}))}, + "Const_funptr3_Deref"} + (TypeFun + [ + TypePrim + (PrimIntegral PrimInt Signed), + TypePrim + (PrimFloating PrimDouble)] + (TypePointer + (TypeQualified + TypeQualifierConst + (TypeMacroTypedef + NamePair { + nameC = Name "A", + nameHsIdent = Identifier "A"} + NameOriginInSource))))))}, declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, @@ -6157,7 +6301,8 @@ TranslationUnit { TypePrim (PrimFloating PrimDouble)] (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -6200,7 +6345,21 @@ TranslationUnit { nameC = Name "const_funptr4_Deref", nameHsIdent = Identifier - "Const_funptr4_Deref"}))}, + "Const_funptr4_Deref"} + (TypeFun + [ + TypePrim + (PrimIntegral PrimInt Signed), + TypePrim + (PrimFloating PrimDouble)] + (TypePointer + (TypeQualified + TypeQualifierConst + (TypeMacroTypedef + NamePair { + nameC = Name "A", + nameHsIdent = Identifier "A"} + NameOriginInSource))))))}, declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, @@ -6251,7 +6410,8 @@ TranslationUnit { (PrimIntegral PrimInt Signed), TypePrim (PrimFloating PrimDouble)] - (TypeConst + (TypeQualified + TypeQualifierConst (TypePointer (TypeMacroTypedef NamePair { @@ -6295,7 +6455,21 @@ TranslationUnit { nameC = Name "const_funptr5_Deref", nameHsIdent = Identifier - "Const_funptr5_Deref"}))}, + "Const_funptr5_Deref"} + (TypeFun + [ + TypePrim + (PrimIntegral PrimInt Signed), + TypePrim + (PrimFloating PrimDouble)] + (TypeQualified + TypeQualifierConst + (TypePointer + (TypeMacroTypedef + NamePair { + nameC = Name "A", + nameHsIdent = Identifier "A"} + NameOriginInSource))))))}, declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, @@ -6346,9 +6520,11 @@ TranslationUnit { (PrimIntegral PrimInt Signed), TypePrim (PrimFloating PrimDouble)] - (TypeConst + (TypeQualified + TypeQualifierConst (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -6391,7 +6567,23 @@ TranslationUnit { nameC = Name "const_funptr6_Deref", nameHsIdent = Identifier - "Const_funptr6_Deref"}))}, + "Const_funptr6_Deref"} + (TypeFun + [ + TypePrim + (PrimIntegral PrimInt Signed), + TypePrim + (PrimFloating PrimDouble)] + (TypeQualified + TypeQualifierConst + (TypePointer + (TypeQualified + TypeQualifierConst + (TypeMacroTypedef + NamePair { + nameC = Name "A", + nameHsIdent = Identifier "A"} + NameOriginInSource)))))))}, declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, @@ -6442,9 +6634,11 @@ TranslationUnit { (PrimIntegral PrimInt Signed), TypePrim (PrimFloating PrimDouble)] - (TypeConst + (TypeQualified + TypeQualifierConst (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -6487,7 +6681,23 @@ TranslationUnit { nameC = Name "const_funptr7_Deref", nameHsIdent = Identifier - "Const_funptr7_Deref"}))}, + "Const_funptr7_Deref"} + (TypeFun + [ + TypePrim + (PrimIntegral PrimInt Signed), + TypePrim + (PrimFloating PrimDouble)] + (TypeQualified + TypeQualifierConst + (TypePointer + (TypeQualified + TypeQualifierConst + (TypeMacroTypedef + NamePair { + nameC = Name "A", + nameHsIdent = Identifier "A"} + NameOriginInSource)))))))}, declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, @@ -6520,7 +6730,8 @@ TranslationUnit { nameHsIdent = Identifier "arg1"}) (TypeIncompleteArray - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -6563,7 +6774,8 @@ TranslationUnit { "arg1"}) (TypeIncompleteArray (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypeMacroTypedef NamePair { nameC = Name "A", @@ -6605,7 +6817,8 @@ TranslationUnit { nameHsIdent = Identifier "arg1"}) (TypeIncompleteArray - (TypeConst + (TypeQualified + TypeQualifierConst (TypePointer (TypeMacroTypedef NamePair { @@ -7013,7 +7226,8 @@ TranslationUnit { TypePrim (PrimFloating PrimDouble)] (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt @@ -7064,7 +7278,8 @@ TranslationUnit { TypePrim (PrimFloating PrimDouble)] (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt @@ -7114,7 +7329,8 @@ TranslationUnit { (PrimIntegral PrimInt Signed), TypePrim (PrimFloating PrimDouble)] - (TypeConst + (TypeQualified + TypeQualifierConst (TypePointer (TypePrim (PrimIntegral @@ -7165,9 +7381,11 @@ TranslationUnit { (PrimIntegral PrimInt Signed), TypePrim (PrimFloating PrimDouble)] - (TypeConst + (TypeQualified + TypeQualifierConst (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt @@ -7217,9 +7435,11 @@ TranslationUnit { (PrimIntegral PrimInt Signed), TypePrim (PrimFloating PrimDouble)] - (TypeConst + (TypeQualified + TypeQualifierConst (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt @@ -7355,9 +7575,11 @@ TranslationUnit { newtypeField = Name "@NsVar" "un_INTCP"}, - macroType = TypeConst + macroType = TypeQualified + TypeQualifierConst (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt diff --git a/hs-bindgen/fixtures/spec_examples.hs b/hs-bindgen/fixtures/spec_examples.hs index b7b3c34cd..8d70a65c0 100644 --- a/hs-bindgen/fixtures/spec_examples.hs +++ b/hs-bindgen/fixtures/spec_examples.hs @@ -671,7 +671,11 @@ NamePair { nameC = Name "int16_T", nameHsIdent = Identifier - "Int16_T"}), + "Int16_T"} + (TypePrim + (PrimIntegral + PrimShort + Signed))), structFieldOffset = 0, structFieldWidth = Nothing}, fieldComment = Just @@ -710,7 +714,11 @@ NamePair { nameC = Name "int16_T", nameHsIdent = Identifier - "Int16_T"}), + "Int16_T"} + (TypePrim + (PrimIntegral + PrimShort + Signed))), structFieldOffset = 16, structFieldWidth = Nothing}, fieldComment = Just @@ -766,7 +774,11 @@ NamePair { nameC = Name "int16_T", nameHsIdent = Identifier - "Int16_T"}), + "Int16_T"} + (TypePrim + (PrimIntegral + PrimShort + Signed))), structFieldOffset = 0, structFieldWidth = Nothing}, StructField { @@ -783,7 +795,11 @@ NamePair { nameC = Name "int16_T", nameHsIdent = Identifier - "Int16_T"}), + "Int16_T"} + (TypePrim + (PrimIntegral + PrimShort + Signed))), structFieldOffset = 16, structFieldWidth = Nothing}], structFlam = Nothing}, @@ -843,7 +859,11 @@ NamePair { nameC = Name "int16_T", nameHsIdent = Identifier - "Int16_T"}), + "Int16_T"} + (TypePrim + (PrimIntegral + PrimShort + Signed))), structFieldOffset = 0, structFieldWidth = Nothing}, fieldComment = Just @@ -882,7 +902,11 @@ NamePair { nameC = Name "int16_T", nameHsIdent = Identifier - "Int16_T"}), + "Int16_T"} + (TypePrim + (PrimIntegral + PrimShort + Signed))), structFieldOffset = 16, structFieldWidth = Nothing}, fieldComment = Just @@ -938,7 +962,11 @@ NamePair { nameC = Name "int16_T", nameHsIdent = Identifier - "Int16_T"}), + "Int16_T"} + (TypePrim + (PrimIntegral + PrimShort + Signed))), structFieldOffset = 0, structFieldWidth = Nothing}, StructField { @@ -955,7 +983,11 @@ NamePair { nameC = Name "int16_T", nameHsIdent = Identifier - "Int16_T"}), + "Int16_T"} + (TypePrim + (PrimIntegral + PrimShort + Signed))), structFieldOffset = 16, structFieldWidth = Nothing}], structFlam = Nothing}, @@ -1018,7 +1050,11 @@ NamePair { nameC = Name "int16_T", nameHsIdent = Identifier - "Int16_T"}), + "Int16_T"} + (TypePrim + (PrimIntegral + PrimShort + Signed))), structFieldOffset = 0, structFieldWidth = Nothing}, fieldComment = Just @@ -1057,7 +1093,11 @@ NamePair { nameC = Name "int16_T", nameHsIdent = Identifier - "Int16_T"}), + "Int16_T"} + (TypePrim + (PrimIntegral + PrimShort + Signed))), structFieldOffset = 16, structFieldWidth = Nothing}, fieldComment = Just @@ -1113,7 +1153,11 @@ NamePair { nameC = Name "int16_T", nameHsIdent = Identifier - "Int16_T"}), + "Int16_T"} + (TypePrim + (PrimIntegral + PrimShort + Signed))), structFieldOffset = 0, structFieldWidth = Nothing}, StructField { @@ -1130,7 +1174,11 @@ NamePair { nameC = Name "int16_T", nameHsIdent = Identifier - "Int16_T"}), + "Int16_T"} + (TypePrim + (PrimIntegral + PrimShort + Signed))), structFieldOffset = 16, structFieldWidth = Nothing}], structFlam = Nothing}, @@ -1195,7 +1243,11 @@ NamePair { nameC = Name "int16_T", nameHsIdent = Identifier - "Int16_T"}), + "Int16_T"} + (TypePrim + (PrimIntegral + PrimShort + Signed))), structFieldOffset = 0, structFieldWidth = Nothing}, fieldComment = Just @@ -1234,7 +1286,11 @@ NamePair { nameC = Name "int16_T", nameHsIdent = Identifier - "Int16_T"}), + "Int16_T"} + (TypePrim + (PrimIntegral + PrimShort + Signed))), structFieldOffset = 16, structFieldWidth = Nothing}, fieldComment = Just @@ -1290,7 +1346,11 @@ NamePair { nameC = Name "int16_T", nameHsIdent = Identifier - "Int16_T"}), + "Int16_T"} + (TypePrim + (PrimIntegral + PrimShort + Signed))), structFieldOffset = 0, structFieldWidth = Nothing}, StructField { @@ -1307,7 +1367,11 @@ NamePair { nameC = Name "int16_T", nameHsIdent = Identifier - "Int16_T"}), + "Int16_T"} + (TypePrim + (PrimIntegral + PrimShort + Signed))), structFieldOffset = 16, structFieldWidth = Nothing}], structFlam = Nothing}, @@ -3048,7 +3112,11 @@ NamePair { nameC = Name "int32_T", nameHsIdent = Identifier - "Int32_T"}))), + "Int32_T"} + (TypePrim + (PrimIntegral + PrimInt + Signed))))), _×_ (Just NamePair { @@ -3079,7 +3147,11 @@ NamePair { nameC = Name "int64_T", nameHsIdent = Identifier - "Int64_T"})), + "Int64_T"} + (TypePrim + (PrimIntegral + PrimLongLong + Signed)))), _×_ (Just NamePair { @@ -3091,7 +3163,11 @@ NamePair { nameC = Name "int64_T", nameHsIdent = Identifier - "Int64_T"})), + "Int64_T"} + (TypePrim + (PrimIntegral + PrimLongLong + Signed)))), _×_ (Just NamePair { @@ -3251,7 +3327,11 @@ NamePair { nameC = Name "int32_T", nameHsIdent = Identifier - "Int32_T"}))), + "Int32_T"} + (TypePrim + (PrimIntegral + PrimInt + Signed))))), _×_ (Just NamePair { @@ -3282,7 +3362,11 @@ NamePair { nameC = Name "int64_T", nameHsIdent = Identifier - "Int64_T"})), + "Int64_T"} + (TypePrim + (PrimIntegral + PrimLongLong + Signed)))), _×_ (Just NamePair { @@ -3294,7 +3378,11 @@ NamePair { nameC = Name "int64_T", nameHsIdent = Identifier - "Int64_T"})), + "Int64_T"} + (TypePrim + (PrimIntegral + PrimLongLong + Signed)))), _×_ (Just NamePair { @@ -3394,7 +3482,11 @@ NamePair { nameC = Name "int32_T", nameHsIdent = Identifier - "Int32_T"})), + "Int32_T"} + (TypePrim + (PrimIntegral + PrimInt + Signed)))), TypeConstArray 30720000 (TypeTypedef @@ -3413,13 +3505,21 @@ NamePair { nameC = Name "int64_T", nameHsIdent = Identifier - "Int64_T"}), + "Int64_T"} + (TypePrim + (PrimIntegral + PrimLongLong + Signed))), TypeTypedef (TypedefRegular NamePair { nameC = Name "int64_T", nameHsIdent = Identifier - "Int64_T"}), + "Int64_T"} + (TypePrim + (PrimIntegral + PrimLongLong + Signed))), TypeConstArray 30720000 (TypeTypedef diff --git a/hs-bindgen/fixtures/spec_examples.tree-diff.txt b/hs-bindgen/fixtures/spec_examples.tree-diff.txt index bf8544814..a9326f64e 100644 --- a/hs-bindgen/fixtures/spec_examples.tree-diff.txt +++ b/hs-bindgen/fixtures/spec_examples.tree-diff.txt @@ -151,7 +151,11 @@ TranslationUnit { NamePair { nameC = Name "int16_T", nameHsIdent = Identifier - "Int16_T"}), + "Int16_T"} + (TypePrim + (PrimIntegral + PrimShort + Signed))), structFieldOffset = 0, structFieldWidth = Nothing}, StructField { @@ -168,7 +172,11 @@ TranslationUnit { NamePair { nameC = Name "int16_T", nameHsIdent = Identifier - "Int16_T"}), + "Int16_T"} + (TypePrim + (PrimIntegral + PrimShort + Signed))), structFieldOffset = 16, structFieldWidth = Nothing}], structFlam = Nothing}, @@ -371,7 +379,11 @@ TranslationUnit { NamePair { nameC = Name "int32_T", nameHsIdent = Identifier - "Int32_T"}))), + "Int32_T"} + (TypePrim + (PrimIntegral + PrimInt + Signed))))), _×_ (Just NamePair { @@ -402,7 +414,11 @@ TranslationUnit { NamePair { nameC = Name "int64_T", nameHsIdent = Identifier - "Int64_T"})), + "Int64_T"} + (TypePrim + (PrimIntegral + PrimLongLong + Signed)))), _×_ (Just NamePair { @@ -414,7 +430,11 @@ TranslationUnit { NamePair { nameC = Name "int64_T", nameHsIdent = Identifier - "Int64_T"})), + "Int64_T"} + (TypePrim + (PrimIntegral + PrimLongLong + Signed)))), _×_ (Just NamePair { diff --git a/hs-bindgen/fixtures/type_qualifiers.hs b/hs-bindgen/fixtures/type_qualifiers.hs index 770449116..c19960269 100644 --- a/hs-bindgen/fixtures/type_qualifiers.hs +++ b/hs-bindgen/fixtures/type_qualifiers.hs @@ -53,7 +53,8 @@ "items"}) (TypePointer (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimChar (PrimSignImplicit Nothing)))))), @@ -138,7 +139,8 @@ "items"}) (TypePointer (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimChar (PrimSignImplicit Nothing)))))), @@ -201,7 +203,8 @@ [ TypePointer (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimChar (PrimSignImplicit Nothing))))), @@ -232,7 +235,8 @@ capiWrapperImport = "type_qualifiers.h"}, foreignImportOrigin = Global - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt Signed))), foreignImportComment = Nothing, @@ -264,7 +268,8 @@ "type_qualifiers.h"}, foreignImportOrigin = Global (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt @@ -295,7 +300,8 @@ capiWrapperImport = "type_qualifiers.h"}, foreignImportOrigin = Global - (TypeConst + (TypeQualified + TypeQualifierConst (TypePointer (TypePrim (PrimIntegral @@ -329,9 +335,11 @@ capiWrapperImport = "type_qualifiers.h"}, foreignImportOrigin = Global - (TypeConst + (TypeQualified + TypeQualifierConst (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt diff --git a/hs-bindgen/fixtures/type_qualifiers.tree-diff.txt b/hs-bindgen/fixtures/type_qualifiers.tree-diff.txt index a09959504..f5fa686cc 100644 --- a/hs-bindgen/fixtures/type_qualifiers.tree-diff.txt +++ b/hs-bindgen/fixtures/type_qualifiers.tree-diff.txt @@ -17,7 +17,8 @@ TranslationUnit { "type_qualifiers.h"}, declComment = Nothing}, declKind = DeclGlobal - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt Signed))), declSpec = DeclSpec @@ -44,7 +45,8 @@ TranslationUnit { declComment = Nothing}, declKind = DeclGlobal (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt @@ -72,7 +74,8 @@ TranslationUnit { "type_qualifiers.h"}, declComment = Nothing}, declKind = DeclGlobal - (TypeConst + (TypeQualified + TypeQualifierConst (TypePointer (TypePrim (PrimIntegral @@ -101,9 +104,11 @@ TranslationUnit { "type_qualifiers.h"}, declComment = Nothing}, declKind = DeclGlobal - (TypeConst + (TypeQualified + TypeQualifierConst (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimIntegral PrimInt @@ -142,7 +147,8 @@ TranslationUnit { "items"}) (TypePointer (TypePointer - (TypeConst + (TypeQualified + TypeQualifierConst (TypePrim (PrimChar (PrimSignImplicit Nothing)))))), diff --git a/hs-bindgen/fixtures/typedef_analysis.hs b/hs-bindgen/fixtures/typedef_analysis.hs index 05490fa0d..6edb7b7eb 100644 --- a/hs-bindgen/fixtures/typedef_analysis.hs +++ b/hs-bindgen/fixtures/typedef_analysis.hs @@ -4793,7 +4793,14 @@ NamePair { nameC = Name "struct5_t", nameHsIdent = Identifier - "Struct5_t"}), + "Struct5_t"} + (TypePointer + (TypeStruct + NamePair { + nameC = Name "struct5", + nameHsIdent = Identifier + "Struct5"} + NameOriginInSource))), structFieldOffset = 128, structFieldWidth = Nothing}, fieldComment = Just @@ -4876,7 +4883,15 @@ NamePair { nameC = Name "struct6", nameHsIdent = Identifier - "Struct6"}), + "Struct6"} + (TypePointer + (TypeStruct + NamePair { + nameC = Name "struct6_Deref", + nameHsIdent = Identifier + "Struct6_Deref"} + (NameOriginRenamedFrom + (Name "struct6"))))), structFieldOffset = 192, structFieldWidth = Nothing}, fieldComment = Just @@ -4917,7 +4932,13 @@ NamePair { nameC = Name "struct7a", nameHsIdent = Identifier - "Struct7a"}), + "Struct7a"} + (TypeStruct + NamePair { + nameC = Name "struct7", + nameHsIdent = Identifier + "Struct7"} + NameOriginInSource)), structFieldOffset = 256, structFieldWidth = Nothing}, fieldComment = Just @@ -4958,7 +4979,13 @@ NamePair { nameC = Name "struct7b", nameHsIdent = Identifier - "Struct7b"}), + "Struct7b"} + (TypeStruct + NamePair { + nameC = Name "struct7", + nameHsIdent = Identifier + "Struct7"} + NameOriginInSource)), structFieldOffset = 256, structFieldWidth = Nothing}, fieldComment = Just @@ -5043,7 +5070,13 @@ NamePair { nameC = Name "struct8b", nameHsIdent = Identifier - "Struct8b"}), + "Struct8b"} + (TypeStruct + NamePair { + nameC = Name "struct8", + nameHsIdent = Identifier + "Struct8"} + NameOriginInSource)), structFieldOffset = 256, structFieldWidth = Nothing}, fieldComment = Just @@ -5128,7 +5161,16 @@ NamePair { nameC = Name "struct9_t", nameHsIdent = Identifier - "Struct9_t"}), + "Struct9_t"} + (TypeTypedef + (TypedefSquashed + (Name "struct9") + (TypeStruct + NamePair { + nameC = Name "struct9", + nameHsIdent = Identifier + "Struct9"} + NameOriginInSource)))), structFieldOffset = 256, structFieldWidth = Nothing}, fieldComment = Just @@ -5214,7 +5256,17 @@ NamePair { nameC = Name "struct10_t_t", nameHsIdent = Identifier - "Struct10_t_t"}), + "Struct10_t_t"} + (TypeTypedef + (TypedefSquashed + (Name "struct10_t") + (TypeStruct + NamePair { + nameC = Name "struct10_t", + nameHsIdent = Identifier + "Struct10_t"} + (NameOriginRenamedFrom + (Name "struct10")))))), structFieldOffset = 256, structFieldWidth = Nothing}, fieldComment = Just @@ -5469,7 +5521,14 @@ NamePair { nameC = Name "struct5_t", nameHsIdent = Identifier - "Struct5_t"}), + "Struct5_t"} + (TypePointer + (TypeStruct + NamePair { + nameC = Name "struct5", + nameHsIdent = Identifier + "Struct5"} + NameOriginInSource))), structFieldOffset = 128, structFieldWidth = Nothing}, StructField { @@ -5506,7 +5565,15 @@ NamePair { nameC = Name "struct6", nameHsIdent = Identifier - "Struct6"}), + "Struct6"} + (TypePointer + (TypeStruct + NamePair { + nameC = Name "struct6_Deref", + nameHsIdent = Identifier + "Struct6_Deref"} + (NameOriginRenamedFrom + (Name "struct6"))))), structFieldOffset = 192, structFieldWidth = Nothing}, StructField { @@ -5524,7 +5591,13 @@ NamePair { nameC = Name "struct7a", nameHsIdent = Identifier - "Struct7a"}), + "Struct7a"} + (TypeStruct + NamePair { + nameC = Name "struct7", + nameHsIdent = Identifier + "Struct7"} + NameOriginInSource)), structFieldOffset = 256, structFieldWidth = Nothing}, StructField { @@ -5542,7 +5615,13 @@ NamePair { nameC = Name "struct7b", nameHsIdent = Identifier - "Struct7b"}), + "Struct7b"} + (TypeStruct + NamePair { + nameC = Name "struct7", + nameHsIdent = Identifier + "Struct7"} + NameOriginInSource)), structFieldOffset = 256, structFieldWidth = Nothing}, StructField { @@ -5581,7 +5660,13 @@ NamePair { nameC = Name "struct8b", nameHsIdent = Identifier - "Struct8b"}), + "Struct8b"} + (TypeStruct + NamePair { + nameC = Name "struct8", + nameHsIdent = Identifier + "Struct8"} + NameOriginInSource)), structFieldOffset = 256, structFieldWidth = Nothing}, StructField { @@ -5620,7 +5705,16 @@ NamePair { nameC = Name "struct9_t", nameHsIdent = Identifier - "Struct9_t"}), + "Struct9_t"} + (TypeTypedef + (TypedefSquashed + (Name "struct9") + (TypeStruct + NamePair { + nameC = Name "struct9", + nameHsIdent = Identifier + "Struct9"} + NameOriginInSource)))), structFieldOffset = 256, structFieldWidth = Nothing}, StructField { @@ -5660,7 +5754,17 @@ NamePair { nameC = Name "struct10_t_t", nameHsIdent = Identifier - "Struct10_t_t"}), + "Struct10_t_t"} + (TypeTypedef + (TypedefSquashed + (Name "struct10_t") + (TypeStruct + NamePair { + nameC = Name "struct10_t", + nameHsIdent = Identifier + "Struct10_t"} + (NameOriginRenamedFrom + (Name "struct10")))))), structFieldOffset = 256, structFieldWidth = Nothing}, StructField { @@ -5991,7 +6095,14 @@ NamePair { nameC = Name "struct5_t", nameHsIdent = Identifier - "Struct5_t"}), + "Struct5_t"} + (TypePointer + (TypeStruct + NamePair { + nameC = Name "struct5", + nameHsIdent = Identifier + "Struct5"} + NameOriginInSource))), structFieldOffset = 128, structFieldWidth = Nothing}, fieldComment = Just @@ -6074,7 +6185,15 @@ NamePair { nameC = Name "struct6", nameHsIdent = Identifier - "Struct6"}), + "Struct6"} + (TypePointer + (TypeStruct + NamePair { + nameC = Name "struct6_Deref", + nameHsIdent = Identifier + "Struct6_Deref"} + (NameOriginRenamedFrom + (Name "struct6"))))), structFieldOffset = 192, structFieldWidth = Nothing}, fieldComment = Just @@ -6115,7 +6234,13 @@ NamePair { nameC = Name "struct7a", nameHsIdent = Identifier - "Struct7a"}), + "Struct7a"} + (TypeStruct + NamePair { + nameC = Name "struct7", + nameHsIdent = Identifier + "Struct7"} + NameOriginInSource)), structFieldOffset = 256, structFieldWidth = Nothing}, fieldComment = Just @@ -6156,7 +6281,13 @@ NamePair { nameC = Name "struct7b", nameHsIdent = Identifier - "Struct7b"}), + "Struct7b"} + (TypeStruct + NamePair { + nameC = Name "struct7", + nameHsIdent = Identifier + "Struct7"} + NameOriginInSource)), structFieldOffset = 256, structFieldWidth = Nothing}, fieldComment = Just @@ -6241,7 +6372,13 @@ NamePair { nameC = Name "struct8b", nameHsIdent = Identifier - "Struct8b"}), + "Struct8b"} + (TypeStruct + NamePair { + nameC = Name "struct8", + nameHsIdent = Identifier + "Struct8"} + NameOriginInSource)), structFieldOffset = 256, structFieldWidth = Nothing}, fieldComment = Just @@ -6326,7 +6463,16 @@ NamePair { nameC = Name "struct9_t", nameHsIdent = Identifier - "Struct9_t"}), + "Struct9_t"} + (TypeTypedef + (TypedefSquashed + (Name "struct9") + (TypeStruct + NamePair { + nameC = Name "struct9", + nameHsIdent = Identifier + "Struct9"} + NameOriginInSource)))), structFieldOffset = 256, structFieldWidth = Nothing}, fieldComment = Just @@ -6412,7 +6558,17 @@ NamePair { nameC = Name "struct10_t_t", nameHsIdent = Identifier - "Struct10_t_t"}), + "Struct10_t_t"} + (TypeTypedef + (TypedefSquashed + (Name "struct10_t") + (TypeStruct + NamePair { + nameC = Name "struct10_t", + nameHsIdent = Identifier + "Struct10_t"} + (NameOriginRenamedFrom + (Name "struct10")))))), structFieldOffset = 256, structFieldWidth = Nothing}, fieldComment = Just @@ -6667,7 +6823,14 @@ NamePair { nameC = Name "struct5_t", nameHsIdent = Identifier - "Struct5_t"}), + "Struct5_t"} + (TypePointer + (TypeStruct + NamePair { + nameC = Name "struct5", + nameHsIdent = Identifier + "Struct5"} + NameOriginInSource))), structFieldOffset = 128, structFieldWidth = Nothing}, StructField { @@ -6704,7 +6867,15 @@ NamePair { nameC = Name "struct6", nameHsIdent = Identifier - "Struct6"}), + "Struct6"} + (TypePointer + (TypeStruct + NamePair { + nameC = Name "struct6_Deref", + nameHsIdent = Identifier + "Struct6_Deref"} + (NameOriginRenamedFrom + (Name "struct6"))))), structFieldOffset = 192, structFieldWidth = Nothing}, StructField { @@ -6722,7 +6893,13 @@ NamePair { nameC = Name "struct7a", nameHsIdent = Identifier - "Struct7a"}), + "Struct7a"} + (TypeStruct + NamePair { + nameC = Name "struct7", + nameHsIdent = Identifier + "Struct7"} + NameOriginInSource)), structFieldOffset = 256, structFieldWidth = Nothing}, StructField { @@ -6740,7 +6917,13 @@ NamePair { nameC = Name "struct7b", nameHsIdent = Identifier - "Struct7b"}), + "Struct7b"} + (TypeStruct + NamePair { + nameC = Name "struct7", + nameHsIdent = Identifier + "Struct7"} + NameOriginInSource)), structFieldOffset = 256, structFieldWidth = Nothing}, StructField { @@ -6779,7 +6962,13 @@ NamePair { nameC = Name "struct8b", nameHsIdent = Identifier - "Struct8b"}), + "Struct8b"} + (TypeStruct + NamePair { + nameC = Name "struct8", + nameHsIdent = Identifier + "Struct8"} + NameOriginInSource)), structFieldOffset = 256, structFieldWidth = Nothing}, StructField { @@ -6818,7 +7007,16 @@ NamePair { nameC = Name "struct9_t", nameHsIdent = Identifier - "Struct9_t"}), + "Struct9_t"} + (TypeTypedef + (TypedefSquashed + (Name "struct9") + (TypeStruct + NamePair { + nameC = Name "struct9", + nameHsIdent = Identifier + "Struct9"} + NameOriginInSource)))), structFieldOffset = 256, structFieldWidth = Nothing}, StructField { @@ -6858,7 +7056,17 @@ NamePair { nameC = Name "struct10_t_t", nameHsIdent = Identifier - "Struct10_t_t"}), + "Struct10_t_t"} + (TypeTypedef + (TypedefSquashed + (Name "struct10_t") + (TypeStruct + NamePair { + nameC = Name "struct10_t", + nameHsIdent = Identifier + "Struct10_t"} + (NameOriginRenamedFrom + (Name "struct10")))))), structFieldOffset = 256, structFieldWidth = Nothing}, StructField { @@ -7192,7 +7400,14 @@ NamePair { nameC = Name "struct5_t", nameHsIdent = Identifier - "Struct5_t"}), + "Struct5_t"} + (TypePointer + (TypeStruct + NamePair { + nameC = Name "struct5", + nameHsIdent = Identifier + "Struct5"} + NameOriginInSource))), structFieldOffset = 128, structFieldWidth = Nothing}, fieldComment = Just @@ -7275,7 +7490,15 @@ NamePair { nameC = Name "struct6", nameHsIdent = Identifier - "Struct6"}), + "Struct6"} + (TypePointer + (TypeStruct + NamePair { + nameC = Name "struct6_Deref", + nameHsIdent = Identifier + "Struct6_Deref"} + (NameOriginRenamedFrom + (Name "struct6"))))), structFieldOffset = 192, structFieldWidth = Nothing}, fieldComment = Just @@ -7316,7 +7539,13 @@ NamePair { nameC = Name "struct7a", nameHsIdent = Identifier - "Struct7a"}), + "Struct7a"} + (TypeStruct + NamePair { + nameC = Name "struct7", + nameHsIdent = Identifier + "Struct7"} + NameOriginInSource)), structFieldOffset = 256, structFieldWidth = Nothing}, fieldComment = Just @@ -7357,7 +7586,13 @@ NamePair { nameC = Name "struct7b", nameHsIdent = Identifier - "Struct7b"}), + "Struct7b"} + (TypeStruct + NamePair { + nameC = Name "struct7", + nameHsIdent = Identifier + "Struct7"} + NameOriginInSource)), structFieldOffset = 256, structFieldWidth = Nothing}, fieldComment = Just @@ -7442,7 +7677,13 @@ NamePair { nameC = Name "struct8b", nameHsIdent = Identifier - "Struct8b"}), + "Struct8b"} + (TypeStruct + NamePair { + nameC = Name "struct8", + nameHsIdent = Identifier + "Struct8"} + NameOriginInSource)), structFieldOffset = 256, structFieldWidth = Nothing}, fieldComment = Just @@ -7527,7 +7768,16 @@ NamePair { nameC = Name "struct9_t", nameHsIdent = Identifier - "Struct9_t"}), + "Struct9_t"} + (TypeTypedef + (TypedefSquashed + (Name "struct9") + (TypeStruct + NamePair { + nameC = Name "struct9", + nameHsIdent = Identifier + "Struct9"} + NameOriginInSource)))), structFieldOffset = 256, structFieldWidth = Nothing}, fieldComment = Just @@ -7613,7 +7863,17 @@ NamePair { nameC = Name "struct10_t_t", nameHsIdent = Identifier - "Struct10_t_t"}), + "Struct10_t_t"} + (TypeTypedef + (TypedefSquashed + (Name "struct10_t") + (TypeStruct + NamePair { + nameC = Name "struct10_t", + nameHsIdent = Identifier + "Struct10_t"} + (NameOriginRenamedFrom + (Name "struct10")))))), structFieldOffset = 256, structFieldWidth = Nothing}, fieldComment = Just @@ -7868,7 +8128,14 @@ NamePair { nameC = Name "struct5_t", nameHsIdent = Identifier - "Struct5_t"}), + "Struct5_t"} + (TypePointer + (TypeStruct + NamePair { + nameC = Name "struct5", + nameHsIdent = Identifier + "Struct5"} + NameOriginInSource))), structFieldOffset = 128, structFieldWidth = Nothing}, StructField { @@ -7905,7 +8172,15 @@ NamePair { nameC = Name "struct6", nameHsIdent = Identifier - "Struct6"}), + "Struct6"} + (TypePointer + (TypeStruct + NamePair { + nameC = Name "struct6_Deref", + nameHsIdent = Identifier + "Struct6_Deref"} + (NameOriginRenamedFrom + (Name "struct6"))))), structFieldOffset = 192, structFieldWidth = Nothing}, StructField { @@ -7923,7 +8198,13 @@ NamePair { nameC = Name "struct7a", nameHsIdent = Identifier - "Struct7a"}), + "Struct7a"} + (TypeStruct + NamePair { + nameC = Name "struct7", + nameHsIdent = Identifier + "Struct7"} + NameOriginInSource)), structFieldOffset = 256, structFieldWidth = Nothing}, StructField { @@ -7941,7 +8222,13 @@ NamePair { nameC = Name "struct7b", nameHsIdent = Identifier - "Struct7b"}), + "Struct7b"} + (TypeStruct + NamePair { + nameC = Name "struct7", + nameHsIdent = Identifier + "Struct7"} + NameOriginInSource)), structFieldOffset = 256, structFieldWidth = Nothing}, StructField { @@ -7980,7 +8267,13 @@ NamePair { nameC = Name "struct8b", nameHsIdent = Identifier - "Struct8b"}), + "Struct8b"} + (TypeStruct + NamePair { + nameC = Name "struct8", + nameHsIdent = Identifier + "Struct8"} + NameOriginInSource)), structFieldOffset = 256, structFieldWidth = Nothing}, StructField { @@ -8019,7 +8312,16 @@ NamePair { nameC = Name "struct9_t", nameHsIdent = Identifier - "Struct9_t"}), + "Struct9_t"} + (TypeTypedef + (TypedefSquashed + (Name "struct9") + (TypeStruct + NamePair { + nameC = Name "struct9", + nameHsIdent = Identifier + "Struct9"} + NameOriginInSource)))), structFieldOffset = 256, structFieldWidth = Nothing}, StructField { @@ -8059,7 +8361,17 @@ NamePair { nameC = Name "struct10_t_t", nameHsIdent = Identifier - "Struct10_t_t"}), + "Struct10_t_t"} + (TypeTypedef + (TypedefSquashed + (Name "struct10_t") + (TypeStruct + NamePair { + nameC = Name "struct10_t", + nameHsIdent = Identifier + "Struct10_t"} + (NameOriginRenamedFrom + (Name "struct10")))))), structFieldOffset = 256, structFieldWidth = Nothing}, StructField { @@ -8411,7 +8723,14 @@ NamePair { nameC = Name "struct5_t", nameHsIdent = Identifier - "Struct5_t"}), + "Struct5_t"} + (TypePointer + (TypeStruct + NamePair { + nameC = Name "struct5", + nameHsIdent = Identifier + "Struct5"} + NameOriginInSource))), structFieldOffset = 128, structFieldWidth = Nothing}, fieldComment = Just @@ -8494,7 +8813,15 @@ NamePair { nameC = Name "struct6", nameHsIdent = Identifier - "Struct6"}), + "Struct6"} + (TypePointer + (TypeStruct + NamePair { + nameC = Name "struct6_Deref", + nameHsIdent = Identifier + "Struct6_Deref"} + (NameOriginRenamedFrom + (Name "struct6"))))), structFieldOffset = 192, structFieldWidth = Nothing}, fieldComment = Just @@ -8535,7 +8862,13 @@ NamePair { nameC = Name "struct7a", nameHsIdent = Identifier - "Struct7a"}), + "Struct7a"} + (TypeStruct + NamePair { + nameC = Name "struct7", + nameHsIdent = Identifier + "Struct7"} + NameOriginInSource)), structFieldOffset = 256, structFieldWidth = Nothing}, fieldComment = Just @@ -8576,7 +8909,13 @@ NamePair { nameC = Name "struct7b", nameHsIdent = Identifier - "Struct7b"}), + "Struct7b"} + (TypeStruct + NamePair { + nameC = Name "struct7", + nameHsIdent = Identifier + "Struct7"} + NameOriginInSource)), structFieldOffset = 256, structFieldWidth = Nothing}, fieldComment = Just @@ -8661,7 +9000,13 @@ NamePair { nameC = Name "struct8b", nameHsIdent = Identifier - "Struct8b"}), + "Struct8b"} + (TypeStruct + NamePair { + nameC = Name "struct8", + nameHsIdent = Identifier + "Struct8"} + NameOriginInSource)), structFieldOffset = 256, structFieldWidth = Nothing}, fieldComment = Just @@ -8746,7 +9091,16 @@ NamePair { nameC = Name "struct9_t", nameHsIdent = Identifier - "Struct9_t"}), + "Struct9_t"} + (TypeTypedef + (TypedefSquashed + (Name "struct9") + (TypeStruct + NamePair { + nameC = Name "struct9", + nameHsIdent = Identifier + "Struct9"} + NameOriginInSource)))), structFieldOffset = 256, structFieldWidth = Nothing}, fieldComment = Just @@ -8832,7 +9186,17 @@ NamePair { nameC = Name "struct10_t_t", nameHsIdent = Identifier - "Struct10_t_t"}), + "Struct10_t_t"} + (TypeTypedef + (TypedefSquashed + (Name "struct10_t") + (TypeStruct + NamePair { + nameC = Name "struct10_t", + nameHsIdent = Identifier + "Struct10_t"} + (NameOriginRenamedFrom + (Name "struct10")))))), structFieldOffset = 256, structFieldWidth = Nothing}, fieldComment = Just @@ -9087,7 +9451,14 @@ NamePair { nameC = Name "struct5_t", nameHsIdent = Identifier - "Struct5_t"}), + "Struct5_t"} + (TypePointer + (TypeStruct + NamePair { + nameC = Name "struct5", + nameHsIdent = Identifier + "Struct5"} + NameOriginInSource))), structFieldOffset = 128, structFieldWidth = Nothing}, StructField { @@ -9124,7 +9495,15 @@ NamePair { nameC = Name "struct6", nameHsIdent = Identifier - "Struct6"}), + "Struct6"} + (TypePointer + (TypeStruct + NamePair { + nameC = Name "struct6_Deref", + nameHsIdent = Identifier + "Struct6_Deref"} + (NameOriginRenamedFrom + (Name "struct6"))))), structFieldOffset = 192, structFieldWidth = Nothing}, StructField { @@ -9142,7 +9521,13 @@ NamePair { nameC = Name "struct7a", nameHsIdent = Identifier - "Struct7a"}), + "Struct7a"} + (TypeStruct + NamePair { + nameC = Name "struct7", + nameHsIdent = Identifier + "Struct7"} + NameOriginInSource)), structFieldOffset = 256, structFieldWidth = Nothing}, StructField { @@ -9160,7 +9545,13 @@ NamePair { nameC = Name "struct7b", nameHsIdent = Identifier - "Struct7b"}), + "Struct7b"} + (TypeStruct + NamePair { + nameC = Name "struct7", + nameHsIdent = Identifier + "Struct7"} + NameOriginInSource)), structFieldOffset = 256, structFieldWidth = Nothing}, StructField { @@ -9199,7 +9590,13 @@ NamePair { nameC = Name "struct8b", nameHsIdent = Identifier - "Struct8b"}), + "Struct8b"} + (TypeStruct + NamePair { + nameC = Name "struct8", + nameHsIdent = Identifier + "Struct8"} + NameOriginInSource)), structFieldOffset = 256, structFieldWidth = Nothing}, StructField { @@ -9238,7 +9635,16 @@ NamePair { nameC = Name "struct9_t", nameHsIdent = Identifier - "Struct9_t"}), + "Struct9_t"} + (TypeTypedef + (TypedefSquashed + (Name "struct9") + (TypeStruct + NamePair { + nameC = Name "struct9", + nameHsIdent = Identifier + "Struct9"} + NameOriginInSource)))), structFieldOffset = 256, structFieldWidth = Nothing}, StructField { @@ -9278,7 +9684,17 @@ NamePair { nameC = Name "struct10_t_t", nameHsIdent = Identifier - "Struct10_t_t"}), + "Struct10_t_t"} + (TypeTypedef + (TypedefSquashed + (Name "struct10_t") + (TypeStruct + NamePair { + nameC = Name "struct10_t", + nameHsIdent = Identifier + "Struct10_t"} + (NameOriginRenamedFrom + (Name "struct10")))))), structFieldOffset = 256, structFieldWidth = Nothing}, StructField { diff --git a/hs-bindgen/fixtures/typedef_analysis.tree-diff.txt b/hs-bindgen/fixtures/typedef_analysis.tree-diff.txt index 0da735df5..12bfb33cc 100644 --- a/hs-bindgen/fixtures/typedef_analysis.tree-diff.txt +++ b/hs-bindgen/fixtures/typedef_analysis.tree-diff.txt @@ -888,7 +888,14 @@ TranslationUnit { NamePair { nameC = Name "struct5_t", nameHsIdent = Identifier - "Struct5_t"}), + "Struct5_t"} + (TypePointer + (TypeStruct + NamePair { + nameC = Name "struct5", + nameHsIdent = Identifier + "Struct5"} + NameOriginInSource))), structFieldOffset = 128, structFieldWidth = Nothing}, StructField { @@ -925,7 +932,15 @@ TranslationUnit { NamePair { nameC = Name "struct6", nameHsIdent = Identifier - "Struct6"}), + "Struct6"} + (TypePointer + (TypeStruct + NamePair { + nameC = Name "struct6_Deref", + nameHsIdent = Identifier + "Struct6_Deref"} + (NameOriginRenamedFrom + (Name "struct6"))))), structFieldOffset = 192, structFieldWidth = Nothing}, StructField { @@ -943,7 +958,13 @@ TranslationUnit { NamePair { nameC = Name "struct7a", nameHsIdent = Identifier - "Struct7a"}), + "Struct7a"} + (TypeStruct + NamePair { + nameC = Name "struct7", + nameHsIdent = Identifier + "Struct7"} + NameOriginInSource)), structFieldOffset = 256, structFieldWidth = Nothing}, StructField { @@ -961,7 +982,13 @@ TranslationUnit { NamePair { nameC = Name "struct7b", nameHsIdent = Identifier - "Struct7b"}), + "Struct7b"} + (TypeStruct + NamePair { + nameC = Name "struct7", + nameHsIdent = Identifier + "Struct7"} + NameOriginInSource)), structFieldOffset = 256, structFieldWidth = Nothing}, StructField { @@ -1000,7 +1027,13 @@ TranslationUnit { NamePair { nameC = Name "struct8b", nameHsIdent = Identifier - "Struct8b"}), + "Struct8b"} + (TypeStruct + NamePair { + nameC = Name "struct8", + nameHsIdent = Identifier + "Struct8"} + NameOriginInSource)), structFieldOffset = 256, structFieldWidth = Nothing}, StructField { @@ -1039,7 +1072,16 @@ TranslationUnit { NamePair { nameC = Name "struct9_t", nameHsIdent = Identifier - "Struct9_t"}), + "Struct9_t"} + (TypeTypedef + (TypedefSquashed + (Name "struct9") + (TypeStruct + NamePair { + nameC = Name "struct9", + nameHsIdent = Identifier + "Struct9"} + NameOriginInSource)))), structFieldOffset = 256, structFieldWidth = Nothing}, StructField { @@ -1079,7 +1121,17 @@ TranslationUnit { NamePair { nameC = Name "struct10_t_t", nameHsIdent = Identifier - "Struct10_t_t"}), + "Struct10_t_t"} + (TypeTypedef + (TypedefSquashed + (Name "struct10_t") + (TypeStruct + NamePair { + nameC = Name "struct10_t", + nameHsIdent = Identifier + "Struct10_t"} + (NameOriginRenamedFrom + (Name "struct10")))))), structFieldOffset = 256, structFieldWidth = Nothing}, StructField { diff --git a/hs-bindgen/fixtures/typedef_vs_macro.hs b/hs-bindgen/fixtures/typedef_vs_macro.hs index 3ee4bee89..74ab79645 100644 --- a/hs-bindgen/fixtures/typedef_vs_macro.hs +++ b/hs-bindgen/fixtures/typedef_vs_macro.hs @@ -968,7 +968,9 @@ (TypedefRegular NamePair { nameC = Name "T1", - nameHsIdent = Identifier "T1"}), + nameHsIdent = Identifier "T1"} + (TypePrim + (PrimIntegral PrimInt Signed))), structFieldOffset = 0, structFieldWidth = Nothing}, fieldComment = Just @@ -1004,7 +1006,11 @@ (TypedefRegular NamePair { nameC = Name "T2", - nameHsIdent = Identifier "T2"}), + nameHsIdent = Identifier "T2"} + (TypePrim + (PrimChar + (PrimSignImplicit + (Just Signed))))), structFieldOffset = 32, structFieldWidth = Nothing}, fieldComment = Just @@ -1134,7 +1140,9 @@ (TypedefRegular NamePair { nameC = Name "T1", - nameHsIdent = Identifier "T1"}), + nameHsIdent = Identifier "T1"} + (TypePrim + (PrimIntegral PrimInt Signed))), structFieldOffset = 0, structFieldWidth = Nothing}, StructField { @@ -1150,7 +1158,11 @@ (TypedefRegular NamePair { nameC = Name "T2", - nameHsIdent = Identifier "T2"}), + nameHsIdent = Identifier "T2"} + (TypePrim + (PrimChar + (PrimSignImplicit + (Just Signed))))), structFieldOffset = 32, structFieldWidth = Nothing}, StructField { @@ -1242,7 +1254,9 @@ (TypedefRegular NamePair { nameC = Name "T1", - nameHsIdent = Identifier "T1"}), + nameHsIdent = Identifier "T1"} + (TypePrim + (PrimIntegral PrimInt Signed))), structFieldOffset = 0, structFieldWidth = Nothing}, fieldComment = Just @@ -1278,7 +1292,11 @@ (TypedefRegular NamePair { nameC = Name "T2", - nameHsIdent = Identifier "T2"}), + nameHsIdent = Identifier "T2"} + (TypePrim + (PrimChar + (PrimSignImplicit + (Just Signed))))), structFieldOffset = 32, structFieldWidth = Nothing}, fieldComment = Just @@ -1408,7 +1426,9 @@ (TypedefRegular NamePair { nameC = Name "T1", - nameHsIdent = Identifier "T1"}), + nameHsIdent = Identifier "T1"} + (TypePrim + (PrimIntegral PrimInt Signed))), structFieldOffset = 0, structFieldWidth = Nothing}, StructField { @@ -1424,7 +1444,11 @@ (TypedefRegular NamePair { nameC = Name "T2", - nameHsIdent = Identifier "T2"}), + nameHsIdent = Identifier "T2"} + (TypePrim + (PrimChar + (PrimSignImplicit + (Just Signed))))), structFieldOffset = 32, structFieldWidth = Nothing}, StructField { @@ -1519,7 +1543,9 @@ (TypedefRegular NamePair { nameC = Name "T1", - nameHsIdent = Identifier "T1"}), + nameHsIdent = Identifier "T1"} + (TypePrim + (PrimIntegral PrimInt Signed))), structFieldOffset = 0, structFieldWidth = Nothing}, fieldComment = Just @@ -1555,7 +1581,11 @@ (TypedefRegular NamePair { nameC = Name "T2", - nameHsIdent = Identifier "T2"}), + nameHsIdent = Identifier "T2"} + (TypePrim + (PrimChar + (PrimSignImplicit + (Just Signed))))), structFieldOffset = 32, structFieldWidth = Nothing}, fieldComment = Just @@ -1685,7 +1715,9 @@ (TypedefRegular NamePair { nameC = Name "T1", - nameHsIdent = Identifier "T1"}), + nameHsIdent = Identifier "T1"} + (TypePrim + (PrimIntegral PrimInt Signed))), structFieldOffset = 0, structFieldWidth = Nothing}, StructField { @@ -1701,7 +1733,11 @@ (TypedefRegular NamePair { nameC = Name "T2", - nameHsIdent = Identifier "T2"}), + nameHsIdent = Identifier "T2"} + (TypePrim + (PrimChar + (PrimSignImplicit + (Just Signed))))), structFieldOffset = 32, structFieldWidth = Nothing}, StructField { @@ -1800,7 +1836,9 @@ (TypedefRegular NamePair { nameC = Name "T1", - nameHsIdent = Identifier "T1"}), + nameHsIdent = Identifier "T1"} + (TypePrim + (PrimIntegral PrimInt Signed))), structFieldOffset = 0, structFieldWidth = Nothing}, fieldComment = Just @@ -1836,7 +1874,11 @@ (TypedefRegular NamePair { nameC = Name "T2", - nameHsIdent = Identifier "T2"}), + nameHsIdent = Identifier "T2"} + (TypePrim + (PrimChar + (PrimSignImplicit + (Just Signed))))), structFieldOffset = 32, structFieldWidth = Nothing}, fieldComment = Just @@ -1966,7 +2008,9 @@ (TypedefRegular NamePair { nameC = Name "T1", - nameHsIdent = Identifier "T1"}), + nameHsIdent = Identifier "T1"} + (TypePrim + (PrimIntegral PrimInt Signed))), structFieldOffset = 0, structFieldWidth = Nothing}, StructField { @@ -1982,7 +2026,11 @@ (TypedefRegular NamePair { nameC = Name "T2", - nameHsIdent = Identifier "T2"}), + nameHsIdent = Identifier "T2"} + (TypePrim + (PrimChar + (PrimSignImplicit + (Just Signed))))), structFieldOffset = 32, structFieldWidth = Nothing}, StructField { diff --git a/hs-bindgen/fixtures/typedef_vs_macro.tree-diff.txt b/hs-bindgen/fixtures/typedef_vs_macro.tree-diff.txt index c78e13dc7..ec4b26714 100644 --- a/hs-bindgen/fixtures/typedef_vs_macro.tree-diff.txt +++ b/hs-bindgen/fixtures/typedef_vs_macro.tree-diff.txt @@ -213,7 +213,9 @@ TranslationUnit { (TypedefRegular NamePair { nameC = Name "T1", - nameHsIdent = Identifier "T1"}), + nameHsIdent = Identifier "T1"} + (TypePrim + (PrimIntegral PrimInt Signed))), structFieldOffset = 0, structFieldWidth = Nothing}, StructField { @@ -229,7 +231,11 @@ TranslationUnit { (TypedefRegular NamePair { nameC = Name "T2", - nameHsIdent = Identifier "T2"}), + nameHsIdent = Identifier "T2"} + (TypePrim + (PrimChar + (PrimSignImplicit + (Just Signed))))), structFieldOffset = 32, structFieldWidth = Nothing}, StructField { diff --git a/hs-bindgen/fixtures/typedefs.hs b/hs-bindgen/fixtures/typedefs.hs index 7e3e2ff25..32068fdcb 100644 --- a/hs-bindgen/fixtures/typedefs.hs +++ b/hs-bindgen/fixtures/typedefs.hs @@ -695,7 +695,8 @@ nameC = Name "FunctionPointer_Function_Deref", nameHsIdent = Identifier - "FunctionPointer_Function_Deref"}))}, + "FunctionPointer_Function_Deref"} + (TypeFun [] TypeVoid)))}, declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, @@ -1140,7 +1141,8 @@ NamePair { nameC = Name "f1_Deref", nameHsIdent = Identifier - "F1_Deref"}))}, + "F1_Deref"} + (TypeFun [] TypeVoid)))}, declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, @@ -1384,8 +1386,8 @@ (TypedefRegular NamePair { nameC = Name "g1", - nameHsIdent = Identifier - "G1"}))}, + nameHsIdent = Identifier "G1"} + (TypeFun [] TypeVoid)))}, declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, @@ -1627,8 +1629,8 @@ (TypedefRegular NamePair { nameC = Name "h1", - nameHsIdent = Identifier - "H1"})}, + nameHsIdent = Identifier "H1"} + (TypeFun [] TypeVoid))}, declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, @@ -1694,8 +1696,13 @@ (TypedefRegular NamePair { nameC = Name "h2", - nameHsIdent = Identifier - "H2"}))}, + nameHsIdent = Identifier "H2"} + (TypeTypedef + (TypedefRegular + NamePair { + nameC = Name "h1", + nameHsIdent = Identifier "H1"} + (TypeFun [] TypeVoid)))))}, declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, diff --git a/hs-bindgen/fixtures/typedefs.tree-diff.txt b/hs-bindgen/fixtures/typedefs.tree-diff.txt index e3cd80b64..6389061dc 100644 --- a/hs-bindgen/fixtures/typedefs.tree-diff.txt +++ b/hs-bindgen/fixtures/typedefs.tree-diff.txt @@ -181,7 +181,8 @@ TranslationUnit { nameC = Name "FunctionPointer_Function_Deref", nameHsIdent = Identifier - "FunctionPointer_Function_Deref"}))}, + "FunctionPointer_Function_Deref"} + (TypeFun [] TypeVoid)))}, declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, @@ -300,7 +301,8 @@ TranslationUnit { NamePair { nameC = Name "f1_Deref", nameHsIdent = Identifier - "F1_Deref"}))}, + "F1_Deref"} + (TypeFun [] TypeVoid)))}, declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, @@ -367,8 +369,8 @@ TranslationUnit { (TypedefRegular NamePair { nameC = Name "g1", - nameHsIdent = Identifier - "G1"}))}, + nameHsIdent = Identifier "G1"} + (TypeFun [] TypeVoid)))}, declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, @@ -434,8 +436,8 @@ TranslationUnit { (TypedefRegular NamePair { nameC = Name "h1", - nameHsIdent = Identifier - "H1"})}, + nameHsIdent = Identifier "H1"} + (TypeFun [] TypeVoid))}, declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, @@ -470,8 +472,13 @@ TranslationUnit { (TypedefRegular NamePair { nameC = Name "h2", - nameHsIdent = Identifier - "H2"}))}, + nameHsIdent = Identifier "H2"} + (TypeTypedef + (TypedefRegular + NamePair { + nameC = Name "h1", + nameHsIdent = Identifier "H1"} + (TypeFun [] TypeVoid)))))}, declSpec = DeclSpec CTypeSpec { cTypeSpecModule = Nothing, diff --git a/hs-bindgen/src-internal/HsBindgen/Backend/Hs/Translation.hs b/hs-bindgen/src-internal/HsBindgen/Backend/Hs/Translation.hs index 91125b402..b3748ac00 100644 --- a/hs-bindgen/src-internal/HsBindgen/Backend/Hs/Translation.hs +++ b/hs-bindgen/src-internal/HsBindgen/Backend/Hs/Translation.hs @@ -149,29 +149,7 @@ generateDeclarations' :: -> [WithCategory Hs.Decl] generateDeclarations' opts haddockConfig moduleName decs = flip State.evalState Map.empty $ - concat <$> mapM (generateDecs opts haddockConfig moduleName typedefs) decs - where - typedefs :: Map C.Name C.Type - typedefs = Map.union actualTypedefs pseudoTypedefs - - -- typedef lookup table - -- shallow: only one layer of typedefs is stripped. - actualTypedefs :: Map C.Name C.Type - actualTypedefs = Map.fromList - [ (C.nameC (C.declId declInfo), typedefType) - | C.Decl{declInfo, declKind} <- decs - , C.DeclTypedef typedef <- [declKind] - , let C.Typedef{typedefType} = typedef - ] - - -- macros also act as "typedef"s - pseudoTypedefs :: Map C.Name C.Type - pseudoTypedefs = Map.fromList - [ (C.nameC (C.declId declInfo), macroType) - | C.Decl{declInfo, declKind} <- decs - , C.DeclMacro macro <- [declKind] - , C.MacroType C.CheckedMacroType{macroType} <- [macro] - ] + concat <$> mapM (generateDecs opts haddockConfig moduleName) decs {------------------------------------------------------------------------------- Instance Map @@ -343,38 +321,37 @@ generateDecs :: => TranslationOpts -> HaddockConfig -> Hs.ModuleName - -> Map C.Name C.Type -> C.Decl -> m [WithCategory Hs.Decl] -generateDecs opts haddockConfig moduleName typedefs (C.Decl info kind spec) = +generateDecs opts haddockConfig moduleName (C.Decl info kind spec) = case kind of C.DeclStruct struct -> withCategoryM BType $ - reifyStructFields struct $ structDecs opts haddockConfig typedefs info struct spec + reifyStructFields struct $ structDecs opts haddockConfig info struct spec C.DeclUnion union -> withCategoryM BType $ - unionDecs haddockConfig typedefs info union spec + unionDecs haddockConfig info union spec C.DeclEnum e -> withCategoryM BType $ - enumDecs opts haddockConfig typedefs info e spec + enumDecs opts haddockConfig info e spec C.DeclTypedef d -> withCategoryM BType $ - typedefDecs opts haddockConfig typedefs info d spec + typedefDecs opts haddockConfig info d spec C.DeclOpaque cNameKind -> withCategoryM BType $ opaqueDecs cNameKind haddockConfig info spec C.DeclFunction f -> let funDeclsWith safety = - functionDecs safety opts haddockConfig moduleName typedefs info f spec + functionDecs safety opts haddockConfig moduleName info f spec funType = (C.TypeFun (snd <$> C.functionArgs f) (C.functionRes f)) -- Declare a function pointer. We can pass this 'FunPtr' to C -- functions that take a function pointer of the appropriate type. funPtrDecls = fst $ - addressStubDecs opts haddockConfig moduleName typedefs info funType spec + addressStubDecs opts haddockConfig moduleName info funType spec in pure $ withCategory BSafe (funDeclsWith SHs.Safe) ++ withCategory BUnsafe (funDeclsWith SHs.Unsafe) ++ withCategory BFunPtr funPtrDecls C.DeclMacro macro -> withCategoryM BType $ - macroDecs opts haddockConfig typedefs info macro spec + macroDecs opts haddockConfig info macro spec C.DeclGlobal ty -> State.get >>= \instsMap -> pure $ withCategory BGlobal $ - global opts haddockConfig moduleName instsMap typedefs info ty spec + global opts haddockConfig moduleName instsMap info ty spec where withCategory :: BindingCategory -> [a] -> [WithCategory a] withCategory c = map (WithCategory c) @@ -398,13 +375,12 @@ structDecs :: forall n m. (SNatI n, State.MonadState InstanceMap m) => TranslationOpts -> HaddockConfig - -> Map C.Name C.Type -> C.DeclInfo -> C.Struct -> C.DeclSpec -> Vec n C.StructField -> m [Hs.Decl] -structDecs opts haddockConfig typedefs info struct spec fields = do +structDecs opts haddockConfig info struct spec fields = do (insts, decls) <- aux <$> State.get State.modify' $ Map.insert structName insts pure decls @@ -415,7 +391,7 @@ structDecs opts haddockConfig typedefs info struct spec fields = do structFields :: Vec n Hs.Field structFields = flip Vec.map fields $ \f -> Hs.Field { fieldName = C.nameHs (C.fieldName (C.structFieldInfo f)) - , fieldType = typ typedefs (C.structFieldType f) + , fieldType = typ (C.structFieldType f) , fieldOrigin = Origin.StructField f , fieldComment = generateHaddocksWithFieldInfo haddockConfig info (C.structFieldInfo f) } @@ -494,7 +470,7 @@ structDecs opts haddockConfig typedefs info struct spec fields = do defineInstanceComment = Nothing , defineInstanceDeclarations = Hs.InstanceHasFLAM hsStruct - (typ typedefs (C.structFieldType flam)) + (typ (C.structFieldType flam)) (C.structFieldOffset flam `div` 8) } @@ -544,12 +520,11 @@ opaqueDecs cNameKind haddockConfig info spec = do unionDecs :: State.MonadState InstanceMap m => HaddockConfig - -> Map C.Name C.Type -> C.DeclInfo -> C.Union -> C.DeclSpec -> m [Hs.Decl] -unionDecs haddockConfig typedefs info union spec = do +unionDecs haddockConfig info union spec = do decls <- aux <$> State.get State.modify' $ Map.insert newtypeName insts pure decls @@ -609,7 +584,7 @@ unionDecs haddockConfig typedefs info union spec = do -- TODO: Should the name mangler take care of the "get" and "set" prefixes? getAccessorDecls :: C.UnionField -> [Hs.Decl] getAccessorDecls C.UnionField{..} = - let hsType = typ typedefs unionFieldType + let hsType = typ unionFieldType fInsts = getInstances instanceMap newtypeName insts [hsType] getterName = "get_" <> C.nameHs (C.fieldName unionFieldInfo) setterName = "set_" <> C.nameHs (C.fieldName unionFieldInfo) @@ -653,12 +628,11 @@ enumDecs :: State.MonadState InstanceMap m => TranslationOpts -> HaddockConfig - -> Map C.Name C.Type -> C.DeclInfo -> C.Enum -> C.DeclSpec -> m [Hs.Decl] -enumDecs opts haddockConfig typedefs info e spec = do +enumDecs opts haddockConfig info e spec = do State.modify' $ Map.insert newtypeName insts pure $ newtypeDecl : storableDecl : optDecls ++ cEnumInstanceDecls ++ valueDecls @@ -672,7 +646,7 @@ enumDecs opts haddockConfig typedefs info e spec = do newtypeField :: Hs.Field newtypeField = Hs.Field { fieldName = C.newtypeField (C.enumNames e) - , fieldType = typ typedefs (C.enumType e) + , fieldType = typ (C.enumType e) , fieldOrigin = Origin.GeneratedField , fieldComment = Nothing } @@ -798,12 +772,11 @@ typedefDecs :: State.MonadState InstanceMap m => TranslationOpts -> HaddockConfig - -> Map C.Name C.Type -> C.DeclInfo -> C.Typedef -> C.DeclSpec -> m [Hs.Decl] -typedefDecs opts haddockConfig typedefs info typedef spec = do +typedefDecs opts haddockConfig info typedef spec = do (insts, decls) <- aux <$> State.get State.modify' $ Map.insert newtypeName insts pure decls @@ -814,7 +787,7 @@ typedefDecs opts haddockConfig typedefs info typedef spec = do newtypeField :: Hs.Field newtypeField = Hs.Field { fieldName = C.newtypeField (C.typedefNames typedef) - , fieldType = typ typedefs (C.typedefType typedef) + , fieldType = typ (C.typedefType typedef) , fieldOrigin = Origin.GeneratedField , fieldComment = Nothing } @@ -888,7 +861,7 @@ typedefDecs opts haddockConfig typedefs info typedef spec = do _ -> [] where hasUnsupportedType :: C.Type -> Bool - hasUnsupportedType = anyFancy . singleton . wrapType typedefs + hasUnsupportedType = anyFancy . singleton . wrapType wrapperParam hsType = Hs.FunctionParameter { functionParameterName = Nothing @@ -951,22 +924,6 @@ typedefDecs opts haddockConfig typedefs info typedef spec = do , clss `Set.member` insts ] --- | Recursively unwrap the underlying type of a typedef. --- --- TODO https://github.com/well-typed/hs-bindgen/issues/1050: Should we panic on --- unbound typedefs? -getUnderlyingType :: HasCallStack => Map C.Name C.Type -> C.Type -> C.Type -getUnderlyingType typedefs = go - where - go (C.TypeTypedef ref) = case ref of - C.TypedefRegular n -> - let err = panicPure $ "Unbound typedef " ++ show n - t' = Map.findWithDefault err (C.nameC n) typedefs - in go t' - C.TypedefSquashed _ t' -> - go t' - go t = t - {------------------------------------------------------------------------------- Macros -------------------------------------------------------------------------------} @@ -975,26 +932,24 @@ macroDecs :: State.MonadState InstanceMap m => TranslationOpts -> HaddockConfig - -> Map C.Name C.Type -> C.DeclInfo -> C.CheckedMacro -> C.DeclSpec -> m [Hs.Decl] -macroDecs opts haddockConfig typedefs info checkedMacro spec = +macroDecs opts haddockConfig info checkedMacro spec = case checkedMacro of - C.MacroType ty -> macroDecsTypedef opts haddockConfig typedefs info ty spec + C.MacroType ty -> macroDecsTypedef opts haddockConfig info ty spec C.MacroExpr expr -> pure $ macroVarDecs haddockConfig info expr macroDecsTypedef :: State.MonadState InstanceMap m => TranslationOpts -> HaddockConfig - -> Map C.Name C.Type -> C.DeclInfo -> C.CheckedMacroType -> C.DeclSpec -> m [Hs.Decl] -macroDecsTypedef opts haddockConfig typedefs info macroType spec = do +macroDecsTypedef opts haddockConfig info macroType spec = do (insts, decls) <- aux (C.macroType macroType) <$> State.get State.modify' $ Map.insert newtypeName insts pure $ decls @@ -1012,7 +967,7 @@ macroDecsTypedef opts haddockConfig typedefs info macroType spec = do newtypeDecl : storableDecl ++ optDecls where fieldType :: HsType - fieldType = typ typedefs ty + fieldType = typ ty insts :: Set Hs.TypeClass insts = getInstances instanceMap newtypeName candidateInsts [fieldType] @@ -1076,14 +1031,14 @@ data TypeContext = | CPtrArg -- ^ Pointer argument deriving stock (Show) -typ :: HasCallStack => Map C.Name C.Type -> C.Type -> Hs.HsType +typ :: HasCallStack => C.Type -> Hs.HsType typ = typ' CTop -typ' :: HasCallStack => TypeContext -> Map C.Name C.Type -> C.Type -> Hs.HsType -typ' ctx typedefs = go ctx +typ' :: HasCallStack => TypeContext -> C.Type -> Hs.HsType +typ' ctx = go ctx where go :: TypeContext -> C.Type -> Hs.HsType - go _ (C.TypeTypedef (C.TypedefRegular name)) = + go _ (C.TypeTypedef (C.TypedefRegular name _)) = Hs.HsTypRef (C.nameHs name) go c (C.TypeTypedef (C.TypedefSquashed _name ty)) = go c ty @@ -1099,9 +1054,14 @@ typ' ctx typedefs = go ctx Hs.HsPrimType (goVoid c) go _ (C.TypePrim p) = Hs.HsPrimType (goPrim p) - go _ (C.TypePointer t) = case getUnderlyingType typedefs t of - C.TypeFun{} -> Hs.HsFunPtr (go CPtrArg t) - _ -> Hs.HsPtr (go CPtrArg t) + go _ (C.TypePointer t) + -- Use a 'FunPtr' if the type is a function type. We inspect the + -- /canonical/ type because we want to see through typedefs and type + -- qualifiers like @const@. + | C.isCanonicalFunctionType t + = Hs.HsFunPtr (go CPtrArg t) + | otherwise + = Hs.HsPtr (go CPtrArg t) go _ (C.TypeConstArray n ty) = Hs.HsConstArray n $ go CTop ty go _ (C.TypeIncompleteArray ty) = @@ -1112,7 +1072,7 @@ typ' ctx typedefs = go ctx HsBlock $ go CTop ty go _ (C.TypeExtBinding ext) = Hs.HsExtBinding (C.extHsRef ext) (C.extHsSpec ext) - go c (C.TypeConst ty) = + go c (C.TypeQualified C.TypeQualifierConst ty) = go c ty go _ (C.TypeComplex p) = Hs.HsComplexType (goPrim p) @@ -1174,9 +1134,8 @@ anyFancy types = any p types where p AType {} = True -- | Types that we cannot directly pass via C FFI. --- -wrapType :: Map C.Name C.Type -> C.Type -> WrappedType -wrapType typedefs ty = go ty +wrapType :: C.Type -> WrappedType +wrapType ty = go ty where go = \case C.TypeStruct {} -> HeapType ty @@ -1184,7 +1143,16 @@ wrapType typedefs ty = go ty C.TypeComplex {} -> HeapType ty (C.TypeConstArray n ty') -> CAType ty n ty' (C.TypeIncompleteArray ty') -> AType ty ty' - (C.TypeTypedef _) -> go $ getUnderlyingType typedefs ty + -- Note: we're only interested in finding the first non-typedef type + -- to determine which method of wrapping to use (.e.g, heap type or + -- primitive type or array type). As such, we erase typedefs only one + -- at a time. If we used 'C.getErasedType' we would erroneously remove + -- typedefs in other places as well, such as in the element types of + -- arrays. We want to keep typedefs there! + (C.TypeTypedef ref) -> go $ C.eraseTypedef ref + -- TODO: macros should get annotations with underlying types just like + -- typedefs, so that we can look through (i.e., erase) them here as well. + -- See issue #1200. _ -> WrapType ty -- | Type in low-level Haskell wrapper @@ -1239,14 +1207,13 @@ wrapperDecl innerName wrapperName res args hsWrapperDecl :: HasCallStack - => Map C.Name C.Type - -> Hs.Name Hs.NsVar -- ^ haskell name + => Hs.Name Hs.NsVar -- ^ haskell name -> Hs.Name Hs.NsVar -- ^ low-level import name -> WrappedType -- ^ result type -> [WrappedType] -- ^ arguments -> Maybe HsDoc.Comment -> SHs.SDecl -hsWrapperDecl typedefs hiName loName res args mbComment = case res of +hsWrapperDecl hiName loName res args mbComment = case res of HeapType {} -> SHs.DVar SHs.Var { @@ -1271,7 +1238,7 @@ hsWrapperDecl typedefs hiName loName res args mbComment = case res of AType {} -> panicPure "Array cannot occur as a result type" where - hsty = foldr HsFun (HsIO $ typ' CFunRes typedefs $ unwrapOrigType res) (typ' CFunArg typedefs . unwrapOrigType <$> args) + hsty = foldr HsFun (HsIO $ typ' CFunRes $ unwrapOrigType res) (typ' CFunArg . unwrapOrigType <$> args) -- wrapper for fancy result goA :: Env ctx WrappedType -> [WrappedType] -> SHs.SExpr ctx @@ -1340,14 +1307,13 @@ functionDecs :: -> TranslationOpts -> HaddockConfig -> Hs.ModuleName - -> Map C.Name C.Type -- ^ typedefs -> C.DeclInfo -> C.Function -> C.DeclSpec -> [Hs.Decl] -functionDecs safety opts haddockConfig moduleName typedefs info f _spec = +functionDecs safety opts haddockConfig moduleName info f _spec = funDecl : [ - Hs.DeclSimple $ hsWrapperDecl typedefs highlevelName importName res wrappedArgTypes mbFIComment + Hs.DeclSimple $ hsWrapperDecl highlevelName importName res wrappedArgTypes mbFIComment | areFancy ] where @@ -1377,28 +1343,28 @@ functionDecs safety opts haddockConfig moduleName typedefs info f _spec = | areFancy = highlevelName <> "_wrapper" -- TODO: Add to NameMangler pass | otherwise = highlevelName - res = wrapType typedefs $ C.functionRes f + res = wrapType $ C.functionRes f (mbFIComment, parsedArgs) = generateHaddocksWithInfoParams haddockConfig info args args = [ Hs.FunctionParameter { functionParameterName = fmap C.nameHs mbName - , functionParameterType = typ' CFunArg typedefs (unwrapType (wrapType typedefs ty)) + , functionParameterType = typ' CFunArg (unwrapType (wrapType ty)) , functionParameterComment = Nothing } | (mbName, ty) <- C.functionArgs f ] wrappedArgTypes = - [ wrapType typedefs ty + [ wrapType ty | (_, ty) <- C.functionArgs f ] resType :: ResultType HsType resType = case res of - HeapType {} -> HeapResultType $ typ' CFunRes typedefs $ unwrapType res + HeapType {} -> HeapResultType $ typ' CFunRes $ unwrapType res - WrapType {} -> NormalResultType $ hsIO $ typ' CFunRes typedefs $ unwrapType res + WrapType {} -> NormalResultType $ hsIO $ typ' CFunRes $ unwrapType res CAType {} -> panicPure "ConstantArray cannot occur as a result type" @@ -1515,28 +1481,25 @@ global :: -> HaddockConfig -> Hs.ModuleName -> InstanceMap - -> Map C.Name C.Type -> C.DeclInfo -> C.Type -> C.DeclSpec -> [Hs.Decl] -global opts haddockConfig moduleName instsMap typedefs info ty _spec = - let underlyingType = case ty of - C.TypeConstArray _ ty' -> ty' - otherType -> getUnderlyingType typedefs otherType - in case underlyingType of - -- Generate getter if the underlying type is @const@. - C.TypeConst _ -> stubDecs ++ getConstGetterOfType ty - _ -> stubDecs +global opts haddockConfig moduleName instsMap info ty _spec + -- Generate getter if the type is @const@-qualified. We inspect the /erased/ + -- type because we want to see through newtypes as well. + | C.isErasedConstQualifiedType ty = stubDecs ++ getConstGetterOfType ty + -- Otherwise, do not generate a getter + | otherwise = stubDecs where -- *** Stub *** stubDecs :: [Hs.Decl] pureStubName :: Hs.Name Hs.NsVar (stubDecs, pureStubName) = - addressStubDecs opts haddockConfig moduleName typedefs info ty _spec + addressStubDecs opts haddockConfig moduleName info ty _spec getConstGetterOfType :: C.Type -> [Hs.Decl] - getConstGetterOfType t = constGetter (typ typedefs t) instsMap info pureStubName + getConstGetterOfType t = constGetter (typ t) instsMap info pureStubName -- | Getter for a constant (i.e., @const@) global variable -- @@ -1604,14 +1567,13 @@ addressStubDecs :: TranslationOpts -> HaddockConfig -> Hs.ModuleName - -> Map C.Name C.Type -> C.DeclInfo -- ^ The given declaration -> C.Type -- ^ The type of the given declaration -> C.DeclSpec -> ( [Hs.Decl] , Hs.Name 'Hs.NsVar ) -addressStubDecs opts haddockConfig moduleName typedefs info ty _spec = +addressStubDecs opts haddockConfig moduleName info ty _spec = (foreignImport : runnerDecls, runnerName) where -- *** Stub (impure) *** @@ -1623,7 +1585,7 @@ addressStubDecs opts haddockConfig moduleName typedefs info ty _spec = stubImportName = Hs.Name $ T.pack stubNameMangled stubImportType :: ResultType HsType - stubImportType = NormalResultType $ HsIO $ typ typedefs stubType + stubImportType = NormalResultType $ HsIO $ typ stubType stubNameMangled :: String stubNameMangled = unUniqueSymbolId $ @@ -1690,7 +1652,7 @@ addressStubDecs opts haddockConfig moduleName typedefs info ty _spec = } runnerName = Hs.Name $ Hs.getIdentifier (C.nameHsIdent (C.declId info)) <> "_ptr" - runnerType = SHs.translateType (typ typedefs stubType) + runnerType = SHs.translateType (typ stubType) runnerExpr = SHs.EGlobal SHs.IO_unsafePerformIO `SHs.EApp` SHs.EFree stubImportName diff --git a/hs-bindgen/src-internal/HsBindgen/Frontend/AST/Coerce.hs b/hs-bindgen/src-internal/HsBindgen/Frontend/AST/Coerce.hs index e20f1896a..7761435a5 100644 --- a/hs-bindgen/src-internal/HsBindgen/Frontend/AST/Coerce.hs +++ b/hs-bindgen/src-internal/HsBindgen/Frontend/AST/Coerce.hs @@ -201,14 +201,15 @@ instance ( instance ( Id p ~ Id p' , ArgumentName p ~ ArgumentName p' - , TypedefRef p ~ TypedefRef p' + , CoercePass TypedefRefWrapper p p' , ExtBinding p ~ ExtBinding p' ) => CoercePass Type p p' where coercePass (TypePrim prim) = TypePrim prim coercePass (TypeStruct uid) = TypeStruct uid coercePass (TypeUnion uid) = TypeUnion uid coercePass (TypeEnum uid) = TypeEnum uid - coercePass (TypeTypedef typedef) = TypeTypedef typedef + coercePass (TypeTypedef typedef) = TypeTypedef $ + unTypedefRefWrapper . coercePass @_ @p @p' . TypedefRefWrapper $ typedef coercePass (TypeMacroTypedef uid) = TypeMacroTypedef uid coercePass (TypePointer typ) = TypePointer (coercePass typ) coercePass (TypeFun args res) = TypeFun (map coercePass args) (coercePass res) diff --git a/hs-bindgen/src-internal/HsBindgen/Frontend/AST/Deps.hs b/hs-bindgen/src-internal/HsBindgen/Frontend/AST/Deps.hs index 0a46a1930..a7ca194d5 100644 --- a/hs-bindgen/src-internal/HsBindgen/Frontend/AST/Deps.hs +++ b/hs-bindgen/src-internal/HsBindgen/Frontend/AST/Deps.hs @@ -91,7 +91,7 @@ depsOfType = \case TypeStruct uid -> [(ByValue, C.qualPrelimDeclId uid (C.NameKindTagged C.TagKindStruct))] TypeUnion uid -> [(ByValue, C.qualPrelimDeclId uid (C.NameKindTagged C.TagKindUnion))] TypeEnum uid -> [(ByValue, C.qualPrelimDeclId uid (C.NameKindTagged C.TagKindEnum))] - TypeTypedef name -> [ + TypeTypedef (OrigTypedefRef name _) -> [ ( ByValue , C.qualPrelimDeclId (C.PrelimDeclIdNamed name) C.NameKindOrdinary ) diff --git a/hs-bindgen/src-internal/HsBindgen/Frontend/AST/External.hs b/hs-bindgen/src-internal/HsBindgen/Frontend/AST/External.hs index 8ed315fd6..d6ac3b532 100644 --- a/hs-bindgen/src-internal/HsBindgen/Frontend/AST/External.hs +++ b/hs-bindgen/src-internal/HsBindgen/Frontend/AST/External.hs @@ -1,3 +1,5 @@ +{-# LANGUAGE EmptyCase #-} + -- | The final C AST after the frontend is done -- -- Intended for qualified import. @@ -37,9 +39,20 @@ module HsBindgen.Frontend.AST.External ( , Int.FunctionAttributes(..) , Int.FunctionPurity(..) -- * Types - , Type(..) + , Type + , TypeF(..) + , TypeQualifier(..) , ResolveBindingSpecs.ResolvedExtBinding(..) , isVoid + , isErasedConstQualifiedType + , isCanonicalFunctionType + -- ** Erasure + , Full + , Erased + , Canonical + , GetErasedType(..) + , GetCanonicalType(..) + , eraseTypedef -- * Names , C.Name(..) , C.TagKind(..) @@ -263,19 +276,25 @@ data CheckedMacroType = CheckedMacroType { Types -------------------------------------------------------------------------------} --- | Type use +-- | C types -- -- For type /declarations/ see 'Decl'. -data Type = +type Type = FullType + +-- | C types in Trees That Shrink style +data TypeF tag = TypePrim C.PrimType | TypeStruct Int.NamePair C.NameOrigin | TypeUnion Int.NamePair C.NameOrigin | TypeEnum Int.NamePair C.NameOrigin - | TypeTypedef TypedefRef + | TypeTypedef (TypedefRefF tag) + -- TODO: macros should get annotations with underlying types just like + -- typedefs, so that we can erase the macro types and replace them with + -- their underlying type. See issue #1200. | TypeMacroTypedef Int.NamePair C.NameOrigin - | TypePointer Type - | TypeConstArray Natural Type - | TypeFun [Type] Type + | TypePointer (TypeF tag) + | TypeConstArray Natural (TypeF tag) + | TypeFun [TypeF tag] (TypeF tag) | TypeVoid -- | Arrays of unknown size @@ -292,18 +311,156 @@ data Type = -- We treat the FLAM case separately. -- -- See - | TypeIncompleteArray Type - | TypeBlock Type - | TypeConst Type + | TypeIncompleteArray (TypeF tag) + | TypeBlock (TypeF tag) + | TypeQualified (TypeQualifierF tag) (TypeF tag) | TypeExtBinding ResolveBindingSpecs.ResolvedExtBinding | TypeComplex C.PrimType + deriving stock Generic + +deriving stock instance (Show (TypedefRefF tag), Show (TypeQualifierF tag)) => Show (TypeF tag) +deriving stock instance (Eq (TypedefRefF tag), Eq (TypeQualifierF tag)) => Eq (TypeF tag) + +data TypeQualifier = TypeQualifierConst deriving stock (Show, Eq, Generic) data TypedefRef = - TypedefRegular Int.NamePair + TypedefRegular + -- | Name of the referenced typedef declaration + Int.NamePair + -- | The underlying type of the referenced typedef declaration + -- + -- NOTE: the underlying type can arbitrarily reference other types, + -- including typedefs that we have not parsed. Use the underlying type with + -- care! + Type | TypedefSquashed C.Name Type deriving stock (Show, Eq, Generic) isVoid :: Type -> Bool isVoid TypeVoid = True isVoid _ = False + +-- | Is the erased type @const@-qualified? +isErasedConstQualifiedType :: GetErasedType t => t -> Bool +isErasedConstQualifiedType ty = case getErasedType ty of + -- Types can be directly @const@-qualified, + TypeQualified TypeQualifierConst _ -> True + -- but arrays are also @const@-qualified if their element type is, + TypeConstArray _ (TypeQualified TypeQualifierConst _) -> True + TypeIncompleteArray (TypeQualified TypeQualifierConst _) -> True + -- and otherwise, the type is not considered to be @const@-qualified. + _ -> False + +-- | Is the canonical type a function type? +isCanonicalFunctionType :: GetCanonicalType t => t -> Bool +isCanonicalFunctionType ty = case getCanonicalType ty of + TypeFun{} -> True + _ -> False + +{------------------------------------------------------------------------------- + Types: Trees That Shrink + + Trees That Grow, but used as Trees That Shrink. Setting these type families to + 'Void' makes it impossible to construct or match on some of the constructors + in the 'TypeF' datatype. +-------------------------------------------------------------------------------} + +type family TypedefRefF tag :: Star +type family TypeQualifierF tag :: Star + +-- | A full C type includes all C type constructs. +type FullType = TypeF Full +data Full +type instance TypedefRefF Full = TypedefRef +type instance TypeQualifierF Full = TypeQualifier + +-- | An /erased/ C type is a C type without @typedef@s. +type ErasedType = TypeF Erased +data Erased +type instance TypedefRefF Erased = Void +type instance TypeQualifierF Erased = TypeQualifier + +-- | A /canonical/ C type is a C type with all sugar removed, such as @typedef@s +-- and type qualifiers like @const@. +type CanonicalType = TypeF Canonical +data Canonical +type instance TypedefRefF Canonical = Void +type instance TypeQualifierF Canonical = Void + +-- | Erase @typedef@s +-- +-- Note: the algorithm to erase @typedef@s is simple. Replace any references to +-- @typedef@s we find by the definitions of these @typedef@s. The @typedef@ +-- definitions that we inline this way can contain references to other +-- @typedef@s, but they can not construct infinitely long types, so this +-- algorithm will terminate sooner or later. In practice, @typedef@ "chains" are +-- probably not that long, so we do not expect this algorithm to have +-- problematic performance. +class GetErasedType t where + -- | Obtain the /erased/ version of the given type + getErasedType :: t -> ErasedType + +instance GetErasedType ErasedType where + getErasedType = id + +instance GetErasedType Type where + getErasedType = go + where + go ty = case ty of + TypePrim pt -> TypePrim pt + TypeStruct np no -> TypeStruct np no + TypeUnion np no -> TypeUnion np no + TypeEnum np no -> TypeEnum np no + TypeTypedef ref -> go (eraseTypedef ref) + TypeMacroTypedef np no -> TypeMacroTypedef np no + TypePointer t -> TypePointer $ go t + TypeConstArray n t -> TypeConstArray n $ go t + TypeFun args res -> TypeFun (go <$> args) (go res) + TypeVoid -> TypeVoid + TypeIncompleteArray t -> TypeIncompleteArray (go t) + TypeBlock t -> TypeBlock (go t) + TypeQualified q t -> TypeQualified q (go t) + TypeExtBinding reb -> TypeExtBinding reb + TypeComplex pt -> TypeComplex pt + +-- | Note: canonicalise types. +-- +-- The algorithm to canonicalise types performs the same @typedef@ erasure that +-- we perform in 'GetErasedType'. Along the way, any type qualifiers like +-- @const@ are also removed. +class GetCanonicalType t where + -- | Obtain the /canonical/ version of the given type + getCanonicalType :: t -> CanonicalType + +instance GetCanonicalType CanonicalType where + getCanonicalType = id + +instance GetCanonicalType Type where + getCanonicalType = go + where + go ty = case ty of + TypePrim pt -> TypePrim pt + TypeStruct np no -> TypeStruct np no + TypeUnion np no -> TypeUnion np no + TypeEnum np no -> TypeEnum np no + TypeTypedef ref -> go (eraseTypedef ref) + TypeMacroTypedef np no -> TypeMacroTypedef np no + TypePointer t -> TypePointer $ go t + TypeConstArray n t -> TypeConstArray n $ go t + TypeFun args res -> TypeFun (go <$> args) (go res) + TypeVoid -> TypeVoid + TypeIncompleteArray t -> TypeIncompleteArray (go t) + TypeBlock t -> TypeBlock (go t) + TypeQualified _q t -> go t + TypeExtBinding reb -> TypeExtBinding reb + TypeComplex pt -> TypeComplex pt + +-- | Erase one layer of a typedef, replacing it by its underlying type. +-- +-- NOTE: the underlying type can arbitrarily reference other types, including +-- typedefs that we have not parsed. Use the underlying type with care! +eraseTypedef :: TypedefRef -> Type +eraseTypedef = \case + TypedefRegular _ t' -> t' + TypedefSquashed _ t' -> t' diff --git a/hs-bindgen/src-internal/HsBindgen/Frontend/AST/Finalize.hs b/hs-bindgen/src-internal/HsBindgen/Frontend/AST/Finalize.hs index 8bb5e4374..34a62f1be 100644 --- a/hs-bindgen/src-internal/HsBindgen/Frontend/AST/Finalize.hs +++ b/hs-bindgen/src-internal/HsBindgen/Frontend/AST/Finalize.hs @@ -280,14 +280,14 @@ instance Finalize Int.Type where finalize (Int.TypeIncompleteArray typ) = Ext.TypeIncompleteArray (finalize typ) finalize (Int.TypeExtBinding ext) = Ext.TypeExtBinding ext finalize (Int.TypeBlock typ) = Ext.TypeBlock (finalize typ) - finalize (Int.TypeConst typ) = Ext.TypeConst (finalize typ) + finalize (Int.TypeConst typ) = Ext.TypeQualified Ext.TypeQualifierConst (finalize typ) finalize (Int.TypeMacroTypedef (np, origin)) = Ext.TypeMacroTypedef np origin finalize (Int.TypeComplex prim) = Ext.TypeComplex prim instance Finalize Int.RenamedTypedefRef where type Finalized Int.RenamedTypedefRef = Ext.TypedefRef - finalize (Int.TypedefRegular (np, _origin)) = Ext.TypedefRegular np + finalize (Int.TypedefRegular (np, _origin) uTy) = Ext.TypedefRegular np (finalize uTy) finalize (Int.TypedefSquashed nm ty) = Ext.TypedefSquashed nm (finalize ty) {------------------------------------------------------------------------------- diff --git a/hs-bindgen/src-internal/HsBindgen/Frontend/AST/PrettyPrinter.hs b/hs-bindgen/src-internal/HsBindgen/Frontend/AST/PrettyPrinter.hs index 24915a15d..82e32d1ec 100644 --- a/hs-bindgen/src-internal/HsBindgen/Frontend/AST/PrettyPrinter.hs +++ b/hs-bindgen/src-internal/HsBindgen/Frontend/AST/PrettyPrinter.hs @@ -156,10 +156,10 @@ showsType x (TypeFun args res) = where named :: Int -> Type -> (ShowS, Type) named i t = (showString "arg" . shows i, t) -showsType x TypeVoid = showString "void " . x 0 -showsType x (TypeIncompleteArray t) = showsType (\_d -> x (arrayPrec + 1) . showString "[]") t -showsType x (TypeExtBinding ext) = showCQualName (extCName ext) . showChar ' ' . x 0 -showsType x (TypeBlock t) = showsType (\_d -> showString "^" . x 0) t +showsType x TypeVoid = showString "void " . x 0 +showsType x (TypeIncompleteArray t) = showsType (\_d -> x (arrayPrec + 1) . showString "[]") t +showsType x (TypeExtBinding ext) = showCQualName (extCName ext) . showChar ' ' . x 0 +showsType x (TypeBlock t) = showsType (\_d -> showString "^" . x 0) t -- Type qualifiers like @const@ can appear before, and _after_ the type they -- refer to. For example, -- @@ -193,7 +193,7 @@ showsType x (TypeBlock t) = showsType (\_d -> showString "^" . x 0) -- constant int" as follows: -- -- > int const * const f(); -showsType x (TypeConst t) = showsType (\_d -> showString "const " . x 0) t +showsType x (TypeQualified TypeQualifierConst t) = showsType (\_d -> showString "const " . x 0) t showsType x (TypeComplex p) = C.showsPrimType p . showChar ' ' . showString "_Complex " . x 0 -- | The precedence of various constructs in C declarations. @@ -254,5 +254,5 @@ showsCName :: Name -> String -> String showsCName = showString . Text.unpack . getName showsTypedefName :: TypedefRef -> String -> String -showsTypedefName (TypedefRegular np) = showsName np NameOriginInSource +showsTypedefName (TypedefRegular np _ty) = showsName np NameOriginInSource showsTypedefName (TypedefSquashed nm _ty) = showsCName nm diff --git a/hs-bindgen/src-internal/HsBindgen/Frontend/Pass.hs b/hs-bindgen/src-internal/HsBindgen/Frontend/Pass.hs index fdc32429b..98f03d680 100644 --- a/hs-bindgen/src-internal/HsBindgen/Frontend/Pass.hs +++ b/hs-bindgen/src-internal/HsBindgen/Frontend/Pass.hs @@ -1,6 +1,7 @@ module HsBindgen.Frontend.Pass ( Pass , IsPass(..) + , TypedefRefWrapper(..) , NoAnn(..) , NoConfig(..) , NoMsg(..) @@ -83,6 +84,10 @@ class IsPass (p :: Pass) where -- | Trace messages possibly emitted by the pass type Msg p :: Star +-- | Newtype wrapper intended for class instances and constraints where +-- partially applied type synonyms are not allowed. +newtype TypedefRefWrapper p = TypedefRefWrapper { unTypedefRefWrapper :: TypedefRef p } + data NoAnn = NoAnn deriving stock (Show, Eq, Ord) diff --git a/hs-bindgen/src-internal/HsBindgen/Frontend/Pass/HandleMacros.hs b/hs-bindgen/src-internal/HsBindgen/Frontend/Pass/HandleMacros.hs index 92381acb9..c3135f8fd 100644 --- a/hs-bindgen/src-internal/HsBindgen/Frontend/Pass/HandleMacros.hs +++ b/hs-bindgen/src-internal/HsBindgen/Frontend/Pass/HandleMacros.hs @@ -239,7 +239,7 @@ processTypedef info C.Typedef{typedefType, typedefAnn} = do _otherwise -> panicPure "unexpected anonymous typedef" updateEnv :: LanC.ReparseEnv HandleMacros -> LanC.ReparseEnv HandleMacros - updateEnv = Map.insert name (C.TypeTypedef name) + updateEnv = Map.insert name (C.TypeTypedef (OrigTypedefRef name (coercePass typedefType))) withoutReparse :: M (C.Decl HandleMacros) withoutReparse = return C.Decl{ diff --git a/hs-bindgen/src-internal/HsBindgen/Frontend/Pass/HandleMacros/IsPass.hs b/hs-bindgen/src-internal/HsBindgen/Frontend/Pass/HandleMacros/IsPass.hs index 4bb04c0ab..5dc3ca55c 100644 --- a/hs-bindgen/src-internal/HsBindgen/Frontend/Pass/HandleMacros/IsPass.hs +++ b/hs-bindgen/src-internal/HsBindgen/Frontend/Pass/HandleMacros/IsPass.hs @@ -10,11 +10,13 @@ import C.Expr.Typecheck.Expr qualified as CExpr.DSL import Clang.HighLevel.Types +import HsBindgen.Frontend.AST.Coerce (CoercePass (..)) import HsBindgen.Frontend.AST.Internal (CheckedMacro, ValidPass) import HsBindgen.Frontend.LanguageC qualified as LanC import HsBindgen.Frontend.Naming qualified as C import HsBindgen.Frontend.Pass -import HsBindgen.Frontend.Pass.Sort.IsPass (DeclMeta) +import HsBindgen.Frontend.Pass.Parse.IsPass (OrigTypedefRef (..)) +import HsBindgen.Frontend.Pass.Sort.IsPass (DeclMeta, Sort) import HsBindgen.Imports import HsBindgen.Util.Tracer @@ -34,7 +36,7 @@ instance IsPass HandleMacros where type Id HandleMacros = C.PrelimDeclId type FieldName HandleMacros = C.Name type ArgumentName HandleMacros = Maybe C.Name - type TypedefRef HandleMacros = C.Name + type TypedefRef HandleMacros = OrigTypedefRef HandleMacros type MacroBody HandleMacros = CheckedMacro HandleMacros type ExtBinding HandleMacros = Void type Ann ix HandleMacros = AnnHandleMacros ix @@ -102,3 +104,10 @@ instance IsTrace Level HandleMacrosMsg where getDefaultLogLevel = const Info getSource = const HsBindgen getTraceId = const "handle-macros" + +{------------------------------------------------------------------------------- + CoercePass +-------------------------------------------------------------------------------} + +instance CoercePass TypedefRefWrapper Sort HandleMacros where + coercePass (TypedefRefWrapper ref) = TypedefRefWrapper (coercePass ref) diff --git a/hs-bindgen/src-internal/HsBindgen/Frontend/Pass/HandleTypedefs.hs b/hs-bindgen/src-internal/HsBindgen/Frontend/Pass/HandleTypedefs.hs index 73faebc58..19939c9e4 100644 --- a/hs-bindgen/src-internal/HsBindgen/Frontend/Pass/HandleTypedefs.hs +++ b/hs-bindgen/src-internal/HsBindgen/Frontend/Pass/HandleTypedefs.hs @@ -11,6 +11,7 @@ import HsBindgen.Frontend.AST.Internal qualified as C import HsBindgen.Frontend.Naming qualified as C import HsBindgen.Frontend.Pass import HsBindgen.Frontend.Pass.HandleTypedefs.IsPass +import HsBindgen.Frontend.Pass.Parse.IsPass (OrigTypedefRef (..)) import HsBindgen.Frontend.Pass.Select.IsPass import HsBindgen.Imports @@ -74,7 +75,7 @@ handleDecl td decl = , C.declKind = C.DeclTypedef $ C.Typedef { typedefType = C.TypePointer . C.TypeTypedef - . TypedefRegular + . flip TypedefRegular (handleUseSites td $ C.TypeFun args res) . C.declId $ C.declInfo derefDecl , typedefAnn = NoAnn @@ -255,8 +256,8 @@ instance HandleUseSites C.Type where Just (newName, newOrigin) -> mkType $ C.DeclId newName newOrigin Nothing -> mkType uid - squash :: C.Name -> C.Type HandleTypedefs - squash name = C.TypeTypedef $ + squash :: TypedefRef Select -> C.Type HandleTypedefs + squash (OrigTypedefRef name uTy) = C.TypeTypedef $ case Map.lookup name (TypedefAnalysis.squash td) of - Nothing -> TypedefRegular $ C.DeclId name C.NameOriginInSource + Nothing -> TypedefRegular (C.DeclId name C.NameOriginInSource) (go uTy) Just ty -> TypedefSquashed name ty diff --git a/hs-bindgen/src-internal/HsBindgen/Frontend/Pass/HandleTypedefs/IsPass.hs b/hs-bindgen/src-internal/HsBindgen/Frontend/Pass/HandleTypedefs/IsPass.hs index 531eab676..93b4c3718 100644 --- a/hs-bindgen/src-internal/HsBindgen/Frontend/Pass/HandleTypedefs/IsPass.hs +++ b/hs-bindgen/src-internal/HsBindgen/Frontend/Pass/HandleTypedefs/IsPass.hs @@ -44,8 +44,16 @@ instance IsPass HandleTypedefs where -- | Reference to a typedef type data RenamedTypedefRef p = - -- | Regular reference - TypedefRegular (Id p) + -- | Regular reference (see 'TypedefRefRegular' for more information). + TypedefRegular + -- | Name of the referenced typedef declaration + (Id p) + -- | The underlying type of the referenced typedef declaration + -- + -- NOTE: the underlying type can arbitrarily reference other types, + -- including typedefs that we have not parsed. Use the underlying type with + -- care! + (C.Type p) -- When we have a typedef around an anonymous declaration: -- diff --git a/hs-bindgen/src-internal/HsBindgen/Frontend/Pass/MangleNames.hs b/hs-bindgen/src-internal/HsBindgen/Frontend/Pass/MangleNames.hs index 1e2db39c7..fbacaa221 100644 --- a/hs-bindgen/src-internal/HsBindgen/Frontend/Pass/MangleNames.hs +++ b/hs-bindgen/src-internal/HsBindgen/Frontend/Pass/MangleNames.hs @@ -475,8 +475,13 @@ instance Mangle C.Type where C.TypeComplex prim -> return $ C.TypeComplex prim instance Mangle RenamedTypedefRef where - mangle (TypedefRegular C.DeclId{..}) = TypedefRegular <$> - mangleQualName (C.QualName declIdName C.NameKindOrdinary) declIdOrigin + mangle (TypedefRegular C.DeclId{..} uTy) = do + -- NOTE: it would have been slightly dangerous to recurse into the + -- underlying type here if the mangling were stateful. Now we're simply + -- applying renamings, so we are fine. + uTy' <- mangle uTy + flip TypedefRegular uTy' <$> + mangleQualName (C.QualName declIdName C.NameKindOrdinary) declIdOrigin mangle (TypedefSquashed cName ty) = TypedefSquashed cName <$> mangle ty diff --git a/hs-bindgen/src-internal/HsBindgen/Frontend/Pass/NameAnon.hs b/hs-bindgen/src-internal/HsBindgen/Frontend/Pass/NameAnon.hs index cb8a4a768..bcd805306 100644 --- a/hs-bindgen/src-internal/HsBindgen/Frontend/Pass/NameAnon.hs +++ b/hs-bindgen/src-internal/HsBindgen/Frontend/Pass/NameAnon.hs @@ -15,7 +15,8 @@ import HsBindgen.Frontend.Naming qualified as C import HsBindgen.Frontend.Pass import HsBindgen.Frontend.Pass.HandleMacros.IsPass import HsBindgen.Frontend.Pass.NameAnon.IsPass -import HsBindgen.Frontend.Pass.Parse.IsPass (ParseMsgKey (..), mapParseMsgs) +import HsBindgen.Frontend.Pass.Parse.IsPass (OrigTypedefRef (..), + ParseMsgKey (..), mapParseMsgs) import HsBindgen.Frontend.Pass.Sort.IsPass import HsBindgen.Imports @@ -258,7 +259,7 @@ instance NameUseSites C.Type where -- Simple cases go (C.TypePrim prim) = C.TypePrim prim - go (C.TypeTypedef name) = C.TypeTypedef name + go (C.TypeTypedef ref) = C.TypeTypedef (nameUseSitesTypedefRef env ref) go (C.TypeVoid) = C.TypeVoid go (C.TypeExtBinding ext) = absurd ext go (C.TypeComplex prim) = C.TypeComplex prim @@ -275,6 +276,13 @@ instance NameUseSites C.Type where C.DeclId (nameForAnon useOfAnon) (C.NameOriginGenerated anonId) Nothing -> panicPure "impossible" +nameUseSitesTypedefRef :: RenameEnv -> TypedefRef HandleMacros -> TypedefRef NameAnon +nameUseSitesTypedefRef env = unTypedefRefWrapper . nameUseSites env . TypedefRefWrapper + +instance NameUseSites TypedefRefWrapper where + nameUseSites env (TypedefRefWrapper (OrigTypedefRef n uTy)) = + TypedefRefWrapper (OrigTypedefRef n (nameUseSites env uTy)) + {------------------------------------------------------------------------------- Name generation diff --git a/hs-bindgen/src-internal/HsBindgen/Frontend/Pass/NameAnon/IsPass.hs b/hs-bindgen/src-internal/HsBindgen/Frontend/Pass/NameAnon/IsPass.hs index 4e934c76f..39b54022b 100644 --- a/hs-bindgen/src-internal/HsBindgen/Frontend/Pass/NameAnon/IsPass.hs +++ b/hs-bindgen/src-internal/HsBindgen/Frontend/Pass/NameAnon/IsPass.hs @@ -29,7 +29,7 @@ instance IsPass NameAnon where type Id NameAnon = C.DeclId type FieldName NameAnon = C.Name type ArgumentName NameAnon = Maybe C.Name - type TypedefRef NameAnon = C.Name + type TypedefRef NameAnon = OrigTypedefRef NameAnon type MacroBody NameAnon = C.CheckedMacro NameAnon type ExtBinding NameAnon = Void type Ann ix NameAnon = AnnNameAnon ix diff --git a/hs-bindgen/src-internal/HsBindgen/Frontend/Pass/Parse/IsPass.hs b/hs-bindgen/src-internal/HsBindgen/Frontend/Pass/Parse/IsPass.hs index 15ad2e37f..3df30301a 100644 --- a/hs-bindgen/src-internal/HsBindgen/Frontend/Pass/Parse/IsPass.hs +++ b/hs-bindgen/src-internal/HsBindgen/Frontend/Pass/Parse/IsPass.hs @@ -2,6 +2,8 @@ module HsBindgen.Frontend.Pass.Parse.IsPass ( Parse , ParseDeclMeta(..) , emptyParseDeclMeta + -- * Typedefs + , OrigTypedefRef(..) -- * Macros , UnparsedMacro(..) , ReparseInfo(..) @@ -57,7 +59,7 @@ instance IsPass Parse where type Id Parse = C.PrelimDeclId type FieldName Parse = C.Name type ArgumentName Parse = Maybe C.Name - type TypedefRef Parse = C.Name + type TypedefRef Parse = OrigTypedefRef Parse type MacroBody Parse = UnparsedMacro type ExtBinding Parse = Void type Ann ix Parse = AnnParse ix @@ -79,6 +81,51 @@ emptyParseDeclMeta = ParseDeclMeta { , parseDeclParseMsg = emptyParseMsgs } +{------------------------------------------------------------------------------- + Typedefs +-------------------------------------------------------------------------------} + +-- A typedef reference. +-- +-- In the example C code below, the type of global variable @x@ is a reference +-- to the typedef @bar@, which is in turn a reference to the typedef @foo@, +-- which is in turn a @const int@. +-- +-- > typedef const int foo; +-- > typedef foo bar; +-- > bar x; +-- +-- In Haskell, the reference to @bar@ records the name of the reference but also +-- the underlying type of @bar@, which is a reference to the typedef @foo@. In +-- turn, the reference to @foo@ records the name of the reference but also the +-- underlying type of @foo@, which is @const int@. The Haskell representation of +-- the type of variable @x@ will look roughly like: +-- +-- > OrigTypedefRef "bar" (OrigTypedefRef "foo" "const int") +-- +-- The underlying type is included so that it can be inspected locally without +-- requiring global information. This is primarily used in the backend, where +-- Haskell binding generation depends on what types look like with all typedefs +-- erased. +data OrigTypedefRef p = OrigTypedefRef + -- | Name of the referenced typedef declaration + C.Name + -- | The underlying type of the referenced typedef declaration + -- + -- NOTE: the underlying type can arbitrarily reference other types, + -- including typedefs that we have not parsed. Use the underlying type with + -- care! + (C.Type p) + deriving stock (Show, Eq, Generic) + +instance ( + Id p ~ Id p' + , ArgumentName p ~ ArgumentName p' + , CoercePass TypedefRefWrapper p p' + , ExtBinding p ~ ExtBinding p' + ) => CoercePass OrigTypedefRef p p' where + coercePass (OrigTypedefRef n uTy) = OrigTypedefRef n (coercePass uTy) + {------------------------------------------------------------------------------- Macros -------------------------------------------------------------------------------} diff --git a/hs-bindgen/src-internal/HsBindgen/Frontend/Pass/Parse/Type.hs b/hs-bindgen/src-internal/HsBindgen/Frontend/Pass/Parse/Type.hs index 3f80d4242..d9f3afa5a 100644 --- a/hs-bindgen/src-internal/HsBindgen/Frontend/Pass/Parse/Type.hs +++ b/hs-bindgen/src-internal/HsBindgen/Frontend/Pass/Parse/Type.hs @@ -109,14 +109,14 @@ fromDecl ty = do CXCursor_EnumDecl -> return $ C.TypeEnum declId CXCursor_StructDecl -> return $ C.TypeStruct declId CXCursor_UnionDecl -> return $ C.TypeUnion declId - CXCursor_TypedefDecl - | declId == C.PrelimDeclIdNamed "va_list" -> - getUnderlyingTypeCursorSpelling decl >>= \case - ClangBuiltin "__builtin_va_list" -> - throwError UnsupportedVariadicFunction - _otherwise -> - C.TypeTypedef <$> typedefName declId - | otherwise -> C.TypeTypedef <$> typedefName declId + CXCursor_TypedefDecl -> do + getUnderlyingTypeCursorSpelling decl >>= \case + ClangBuiltin "__builtin_va_list" | declId == C.PrelimDeclIdNamed "va_list" -> + throwError UnsupportedVariadicFunction + _ -> do + uTy <- cxtype =<< getUnderlyingCXType decl + n <- typedefName declId + pure (C.TypeTypedef $ OrigTypedefRef n uTy) kind -> throwError $ UnexpectedTypeDecl (Right kind) where typedefName :: C.PrelimDeclId -> ParseType C.Name @@ -125,15 +125,19 @@ fromDecl ty = do C.PrelimDeclIdAnon{} -> panicPure "Unexpected anonymous typedef" C.PrelimDeclIdBuiltin name -> throwError $ UnsupportedBuiltin name - getUnderlyingTypeCursorSpelling :: MonadIO m => CXCursor -> m CursorSpelling - getUnderlyingTypeCursorSpelling typedefCurr = do - uType <- clang_getTypedefDeclUnderlyingType typedefCurr + getUnderlyingCXType :: MonadIO m => CXCursor -> m CXType + getUnderlyingCXType typedefCurr = do + uTy <- clang_getTypedefDeclUnderlyingType typedefCurr -- Later versions of Clang use elaborated types, earlier versions do not - uType' <- case fromSimpleEnum (cxtKind uType) of - Right CXType_Elaborated -> clang_Type_getNamedType uType - Right{} -> return uType + case fromSimpleEnum (cxtKind uTy) of + Right CXType_Elaborated -> clang_Type_getNamedType uTy + Right{} -> return uTy _otherwise -> panicPure "Invalid underlying type" - uDecl <-clang_getTypeDeclaration uType' + + getUnderlyingTypeCursorSpelling :: MonadIO m => CXCursor -> m CursorSpelling + getUnderlyingTypeCursorSpelling typedefCurr = do + uTy <- getUnderlyingCXType typedefCurr + uDecl <- clang_getTypeDeclaration uTy HighLevel.clang_getCursorSpelling uDecl function :: Bool -> CXType -> ParseType (C.Type Parse) diff --git a/hs-bindgen/src-internal/HsBindgen/Frontend/Pass/ResolveBindingSpecs.hs b/hs-bindgen/src-internal/HsBindgen/Frontend/Pass/ResolveBindingSpecs.hs index 9a49d5ef9..a504e315c 100644 --- a/hs-bindgen/src-internal/HsBindgen/Frontend/Pass/ResolveBindingSpecs.hs +++ b/hs-bindgen/src-internal/HsBindgen/Frontend/Pass/ResolveBindingSpecs.hs @@ -24,6 +24,7 @@ import HsBindgen.Frontend.NonParsedDecls (NonParsedDecls) import HsBindgen.Frontend.NonParsedDecls qualified as NonParsedDecls import HsBindgen.Frontend.Pass import HsBindgen.Frontend.Pass.NameAnon.IsPass +import HsBindgen.Frontend.Pass.Parse.IsPass (OrigTypedefRef (..)) import HsBindgen.Frontend.Pass.ResolveBindingSpecs.IsPass import HsBindgen.Frontend.Pass.Sort.IsPass import HsBindgen.Imports @@ -378,8 +379,11 @@ instance Resolve C.Type where auxU C.TypeEnum uid (C.NameKindTagged C.TagKindEnum) C.TypeMacroTypedef uid -> auxU C.TypeMacroTypedef uid C.NameKindOrdinary - C.TypeTypedef nm -> - auxN C.TypeTypedef nm C.NameKindOrdinary + C.TypeTypedef (OrigTypedefRef nm uTy) -> do + (_uTyDepIds, uTy') <- resolve uTy + let mkTypeTypedef = C.TypeTypedef . flip OrigTypedefRef uTy' + (tdDepIds, td) <- auxN mkTypeTypedef nm C.NameKindOrdinary + pure (tdDepIds, td) -- Recursive cases C.TypePointer t -> fmap C.TypePointer <$> resolve t diff --git a/hs-bindgen/src-internal/HsBindgen/Frontend/Pass/ResolveBindingSpecs/IsPass.hs b/hs-bindgen/src-internal/HsBindgen/Frontend/Pass/ResolveBindingSpecs/IsPass.hs index 7bc3246e0..303c86795 100644 --- a/hs-bindgen/src-internal/HsBindgen/Frontend/Pass/ResolveBindingSpecs/IsPass.hs +++ b/hs-bindgen/src-internal/HsBindgen/Frontend/Pass/ResolveBindingSpecs/IsPass.hs @@ -10,6 +10,7 @@ import HsBindgen.BindingSpec qualified as BindingSpec import HsBindgen.Frontend.AST.Internal (CheckedMacro, ValidPass) import HsBindgen.Frontend.Naming qualified as C import HsBindgen.Frontend.Pass +import HsBindgen.Frontend.Pass.Parse.IsPass (OrigTypedefRef) import HsBindgen.Frontend.Pass.Sort.IsPass (DeclMeta) import HsBindgen.Imports import HsBindgen.Language.Haskell qualified as Hs @@ -41,7 +42,7 @@ instance IsPass ResolveBindingSpecs where type Id ResolveBindingSpecs = C.DeclId type FieldName ResolveBindingSpecs = C.Name type ArgumentName ResolveBindingSpecs = Maybe C.Name - type TypedefRef ResolveBindingSpecs = C.Name + type TypedefRef ResolveBindingSpecs = OrigTypedefRef ResolveBindingSpecs type MacroBody ResolveBindingSpecs = CheckedMacro ResolveBindingSpecs type ExtBinding ResolveBindingSpecs = ResolvedExtBinding type Ann ix ResolveBindingSpecs = AnnResolveBindingSpecs ix diff --git a/hs-bindgen/src-internal/HsBindgen/Frontend/Pass/Select/IsPass.hs b/hs-bindgen/src-internal/HsBindgen/Frontend/Pass/Select/IsPass.hs index ab014ef5f..181bd7486 100644 --- a/hs-bindgen/src-internal/HsBindgen/Frontend/Pass/Select/IsPass.hs +++ b/hs-bindgen/src-internal/HsBindgen/Frontend/Pass/Select/IsPass.hs @@ -17,6 +17,7 @@ import HsBindgen.BindingSpec qualified as BindingSpec import HsBindgen.Frontend.Analysis.DeclIndex import HsBindgen.Frontend.Analysis.DeclUseGraph import HsBindgen.Frontend.Analysis.UseDeclGraph +import HsBindgen.Frontend.AST.Coerce (CoercePass (coercePass)) import HsBindgen.Frontend.AST.Internal (CheckedMacro, ValidPass) import HsBindgen.Frontend.AST.Internal qualified as C import HsBindgen.Frontend.Naming qualified as C @@ -44,7 +45,7 @@ instance IsPass Select where type Id Select = C.DeclId type FieldName Select = C.Name type ArgumentName Select = Maybe C.Name - type TypedefRef Select = C.Name + type TypedefRef Select = OrigTypedefRef Select -- NOTE Using @CheckedMacro Select@ is incompatible with 'CoercePass' type MacroBody Select = CheckedMacro ResolveBindingSpecs type ExtBinding Select = ResolvedExtBinding @@ -146,3 +147,10 @@ instance IsTrace Level SelectMsg where SelectParse _ x -> "select-parse-" <> getTraceId x SelectFailed _ x -> "select-missed-" <> getTraceId x _else -> "select" + +{------------------------------------------------------------------------------- + CoercePass +-------------------------------------------------------------------------------} + +instance CoercePass TypedefRefWrapper ResolveBindingSpecs Select where + coercePass (TypedefRefWrapper ref) = TypedefRefWrapper (coercePass ref) diff --git a/hs-bindgen/src-internal/HsBindgen/Frontend/Pass/Sort/IsPass.hs b/hs-bindgen/src-internal/HsBindgen/Frontend/Pass/Sort/IsPass.hs index 139aacb86..bf9b44d11 100644 --- a/hs-bindgen/src-internal/HsBindgen/Frontend/Pass/Sort/IsPass.hs +++ b/hs-bindgen/src-internal/HsBindgen/Frontend/Pass/Sort/IsPass.hs @@ -8,6 +8,7 @@ module HsBindgen.Frontend.Pass.Sort.IsPass ( import HsBindgen.Frontend.Analysis.DeclIndex import HsBindgen.Frontend.Analysis.DeclUseGraph import HsBindgen.Frontend.Analysis.UseDeclGraph +import HsBindgen.Frontend.AST.Coerce (CoercePass (..)) import HsBindgen.Frontend.AST.Internal (ValidPass) import HsBindgen.Frontend.Naming qualified as C import HsBindgen.Frontend.NonParsedDecls @@ -38,7 +39,7 @@ instance IsPass Sort where type Id Sort = C.PrelimDeclId type FieldName Sort = C.Name type ArgumentName Sort = Maybe C.Name - type TypedefRef Sort = C.Name + type TypedefRef Sort = OrigTypedefRef Sort type MacroBody Sort = UnparsedMacro type ExtBinding Sort = Void type Ann ix Sort = AnnSort ix @@ -72,3 +73,10 @@ data SortMsg = SortErrorDeclIndex DeclIndexError deriving stock (Show, Generic) deriving anyclass (PrettyForTrace, IsTrace Level) + +{------------------------------------------------------------------------------- + CoercePass +-------------------------------------------------------------------------------} + +instance CoercePass TypedefRefWrapper Parse Sort where + coercePass (TypedefRefWrapper p) = TypedefRefWrapper (coercePass p) diff --git a/hs-bindgen/test/hs-bindgen/Test/HsBindgen/Orphans/TreeDiff.hs b/hs-bindgen/test/hs-bindgen/Test/HsBindgen/Orphans/TreeDiff.hs index aabc9b36a..a7a473e03 100644 --- a/hs-bindgen/test/hs-bindgen/Test/HsBindgen/Orphans/TreeDiff.hs +++ b/hs-bindgen/test/hs-bindgen/Test/HsBindgen/Orphans/TreeDiff.hs @@ -93,6 +93,7 @@ instance ToExpr C.StructField instance ToExpr C.TagKind instance ToExpr C.TranslationUnit instance ToExpr C.Type +instance ToExpr C.TypeQualifier instance ToExpr C.Typedef instance ToExpr C.TypedefRef instance ToExpr C.Union