Skip to content

Commit 4a22762

Browse files
authored
Merge pull request #1189 from well-typed/tcard/binding-spec-refactor
Refactor binding specifications
2 parents ab9d967 + 3a14937 commit 4a22762

File tree

223 files changed

+16350
-15427
lines changed

Some content is hidden

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

223 files changed

+16350
-15427
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
typedef char sym;
2+
3+
struct pt {
4+
double x;
5+
double y;
6+
};
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
version:
2+
hs_bindgen: 0.1.0
3+
binding_specification: '1.0'
4+
types:
5+
- omit:
6+
headers: binding_spec_simple.h
7+
cname: struct pt
8+
- headers: binding_spec_simple.h
9+
cname: sym
10+
module: Generated
11+
hsname: Sym
12+
instances:
13+
- Bits
14+
- Bounded
15+
- Enum
16+
- Eq
17+
- FiniteBits
18+
- Integral
19+
- Ix
20+
- Num
21+
- Ord
22+
- Read
23+
- Real
24+
- Show
25+
- Storable

hs-bindgen/examples/golden/program_slicing_simple.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@ types:
55
- headers: program_slicing_simple.h
66
cname: uint64_t
77
module: Example
8-
identifier: Uint64_t
8+
hsname: Uint64_t
99
instances:
10-
- Eq
11-
- Ord
12-
- Enum
13-
- Ix
14-
- Bounded
15-
- Read
16-
- Show
1710
- Bits
11+
- Bounded
12+
- Enum
13+
- Eq
1814
- FiniteBits
1915
- Integral
16+
- Ix
2017
- Num
18+
- Ord
19+
- Read
2120
- Real
21+
- Show
2222
- Storable

hs-bindgen/fixtures/adios.bindingspec.yaml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,36 +5,36 @@ types:
55
- headers: adios.h
66
cname: adiós
77
module: Example
8-
identifier: Adio'0301s
8+
hsname: Adio'0301s
99
instances:
10-
- Eq
11-
- Ord
12-
- Enum
13-
- Ix
14-
- Bounded
15-
- Read
16-
- Show
1710
- Bits
11+
- Bounded
12+
- Enum
13+
- Eq
1814
- FiniteBits
1915
- Integral
16+
- Ix
2017
- Num
18+
- Ord
19+
- Read
2120
- Real
21+
- Show
2222
- Storable
2323
- headers: adios.h
2424
cname: 数字
2525
module: Example
26-
identifier: C数字
26+
hsname: C数字
2727
instances:
28-
- Eq
29-
- Ord
30-
- Enum
31-
- Ix
32-
- Bounded
33-
- Read
34-
- Show
3528
- Bits
29+
- Bounded
30+
- Enum
31+
- Eq
3632
- FiniteBits
3733
- Integral
34+
- Ix
3835
- Num
36+
- Ord
37+
- Read
3938
- Real
39+
- Show
4040
- Storable

hs-bindgen/fixtures/adios.hs

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -42,25 +42,25 @@
4242
typedefType = TypePrim
4343
(PrimIntegral PrimInt Signed)},
4444
declSpec = DeclSpec
45-
TypeSpec {
46-
typeSpecModule = Nothing,
47-
typeSpecIdentifier = Nothing,
48-
typeSpecInstances = Map.fromList
49-
[]}},
45+
CTypeSpec {
46+
cTypeSpecModule = Nothing,
47+
cTypeSpecIdentifier = Nothing,
48+
cTypeSpecInstances =
49+
Map.fromList []}},
5050
newtypeInstances = Set.fromList
5151
[
52-
Eq,
53-
Ord,
54-
Enum,
55-
Ix,
56-
Bounded,
57-
Read,
58-
Show,
5952
Bits,
53+
Bounded,
54+
Enum,
55+
Eq,
6056
FiniteBits,
6157
Integral,
58+
Ix,
6259
Num,
60+
Ord,
61+
Read,
6362
Real,
63+
Show,
6464
Storable],
6565
newtypeComment = Just
6666
Comment {
@@ -249,25 +249,25 @@
249249
typedefType = TypePrim
250250
(PrimIntegral PrimInt Signed)},
251251
declSpec = DeclSpec
252-
TypeSpec {
253-
typeSpecModule = Nothing,
254-
typeSpecIdentifier = Nothing,
255-
typeSpecInstances = Map.fromList
256-
[]}},
252+
CTypeSpec {
253+
cTypeSpecModule = Nothing,
254+
cTypeSpecIdentifier = Nothing,
255+
cTypeSpecInstances =
256+
Map.fromList []}},
257257
newtypeInstances = Set.fromList
258258
[
259-
Eq,
260-
Ord,
261-
Enum,
262-
Ix,
263-
Bounded,
264-
Read,
265-
Show,
266259
Bits,
260+
Bounded,
261+
Enum,
262+
Eq,
267263
FiniteBits,
268264
Integral,
265+
Ix,
269266
Num,
267+
Ord,
268+
Read,
270269
Real,
270+
Show,
271271
Storable],
272272
newtypeComment = Just
273273
Comment {

hs-bindgen/fixtures/adios.tree-diff.txt

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ TranslationUnit {
2727
typedefType = TypePrim
2828
(PrimIntegral PrimInt Signed)},
2929
declSpec = DeclSpec
30-
TypeSpec {
31-
typeSpecModule = Nothing,
32-
typeSpecIdentifier = Nothing,
33-
typeSpecInstances = Map.fromList
34-
[]}},
30+
CTypeSpec {
31+
cTypeSpecModule = Nothing,
32+
cTypeSpecIdentifier = Nothing,
33+
cTypeSpecInstances =
34+
Map.fromList []}},
3535
Decl {
3636
declInfo = DeclInfo {
3737
declLoc = "adios.h:12:13",
@@ -59,11 +59,11 @@ TranslationUnit {
5959
typedefType = TypePrim
6060
(PrimIntegral PrimInt Signed)},
6161
declSpec = DeclSpec
62-
TypeSpec {
63-
typeSpecModule = Nothing,
64-
typeSpecIdentifier = Nothing,
65-
typeSpecInstances = Map.fromList
66-
[]}},
62+
CTypeSpec {
63+
cTypeSpecModule = Nothing,
64+
cTypeSpecIdentifier = Nothing,
65+
cTypeSpecInstances =
66+
Map.fromList []}},
6767
Decl {
6868
declInfo = DeclInfo {
6969
declLoc = "adios.h:18:6",
@@ -87,11 +87,11 @@ TranslationUnit {
8787
ImpureFunction,
8888
functionRes = TypeVoid},
8989
declSpec = DeclSpec
90-
TypeSpec {
91-
typeSpecModule = Nothing,
92-
typeSpecIdentifier = Nothing,
93-
typeSpecInstances = Map.fromList
94-
[]}},
90+
CTypeSpec {
91+
cTypeSpecModule = Nothing,
92+
cTypeSpecIdentifier = Nothing,
93+
cTypeSpecInstances =
94+
Map.fromList []}},
9595
Decl {
9696
declInfo = DeclInfo {
9797
declLoc = "adios.h:21:12",
@@ -111,11 +111,11 @@ TranslationUnit {
111111
(TypePrim
112112
(PrimIntegral PrimInt Signed)),
113113
declSpec = DeclSpec
114-
TypeSpec {
115-
typeSpecModule = Nothing,
116-
typeSpecIdentifier = Nothing,
117-
typeSpecInstances = Map.fromList
118-
[]}},
114+
CTypeSpec {
115+
cTypeSpecModule = Nothing,
116+
cTypeSpecIdentifier = Nothing,
117+
cTypeSpecInstances =
118+
Map.fromList []}},
119119
Decl {
120120
declInfo = DeclInfo {
121121
declLoc = "adios.h:24:18",
@@ -136,11 +136,11 @@ TranslationUnit {
136136
(TypePrim
137137
(PrimIntegral PrimInt Signed))),
138138
declSpec = DeclSpec
139-
TypeSpec {
140-
typeSpecModule = Nothing,
141-
typeSpecIdentifier = Nothing,
142-
typeSpecInstances = Map.fromList
143-
[]}},
139+
CTypeSpec {
140+
cTypeSpecModule = Nothing,
141+
cTypeSpecIdentifier = Nothing,
142+
cTypeSpecInstances =
143+
Map.fromList []}},
144144
Decl {
145145
declInfo = DeclInfo {
146146
declLoc = "adios.h:27:6",
@@ -164,11 +164,11 @@ TranslationUnit {
164164
ImpureFunction,
165165
functionRes = TypeVoid},
166166
declSpec = DeclSpec
167-
TypeSpec {
168-
typeSpecModule = Nothing,
169-
typeSpecIdentifier = Nothing,
170-
typeSpecInstances = Map.fromList
171-
[]}},
167+
CTypeSpec {
168+
cTypeSpecModule = Nothing,
169+
cTypeSpecIdentifier = Nothing,
170+
cTypeSpecInstances =
171+
Map.fromList []}},
172172
Decl {
173173
declInfo = DeclInfo {
174174
declLoc = "adios.h:31:6",
@@ -192,9 +192,9 @@ TranslationUnit {
192192
ImpureFunction,
193193
functionRes = TypeVoid},
194194
declSpec = DeclSpec
195-
TypeSpec {
196-
typeSpecModule = Nothing,
197-
typeSpecIdentifier = Nothing,
198-
typeSpecInstances = Map.fromList
199-
[]}}],
195+
CTypeSpec {
196+
cTypeSpecModule = Nothing,
197+
cTypeSpecIdentifier = Nothing,
198+
cTypeSpecInstances =
199+
Map.fromList []}}],
200200
unitDeps = ["adios"]}

hs-bindgen/fixtures/anonymous.bindingspec.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,55 +5,55 @@ types:
55
- headers: anonymous.h
66
cname: struct S1
77
module: Example
8-
identifier: S1
8+
hsname: S1
99
instances:
1010
- Eq
1111
- Show
1212
- Storable
1313
- headers: anonymous.h
1414
cname: S1_c
1515
module: Example
16-
identifier: S1_c
16+
hsname: S1_c
1717
instances:
1818
- Eq
1919
- Show
2020
- Storable
2121
- headers: anonymous.h
2222
cname: struct S2
2323
module: Example
24-
identifier: S2
24+
hsname: S2
2525
instances:
2626
- Eq
2727
- Show
2828
- Storable
2929
- headers: anonymous.h
3030
cname: S2_inner
3131
module: Example
32-
identifier: S2_inner
32+
hsname: S2_inner
3333
instances:
3434
- Eq
3535
- Show
3636
- Storable
3737
- headers: anonymous.h
3838
cname: S2_inner_deep
3939
module: Example
40-
identifier: S2_inner_deep
40+
hsname: S2_inner_deep
4141
instances:
4242
- Eq
4343
- Show
4444
- Storable
4545
- headers: anonymous.h
4646
cname: struct S3
4747
module: Example
48-
identifier: S3
48+
hsname: S3
4949
instances:
5050
- Eq
5151
- Show
5252
- Storable
5353
- headers: anonymous.h
5454
cname: S3_c
5555
module: Example
56-
identifier: S3_c
56+
hsname: S3_c
5757
instances:
5858
- Eq
5959
- Show

0 commit comments

Comments
 (0)