forked from mozilla/cbindgen
/
destructor_and_copy_ctor.pyx
145 lines (118 loc) · 2.75 KB
/
destructor_and_copy_ctor.pyx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
#define NOINLINE __attribute__((noinline))
#define NODISCARD [[nodiscard]]
from libc.stdint cimport int8_t, int16_t, int32_t, int64_t, intptr_t
from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t
cdef extern from *:
ctypedef bint bool
ctypedef struct va_list
cdef extern from *:
cdef enum:
A,
B,
ctypedef uint8_t FillRule;
# This will have a destructor manually implemented via variant_body, and
# similarly a Drop impl in Rust.
ctypedef struct OwnedSlice_u32:
uintptr_t len;
uint32_t *ptr;
ctypedef struct Polygon_u32:
FillRule fill;
OwnedSlice_u32 coordinates;
# This will have a destructor manually implemented via variant_body, and
# similarly a Drop impl in Rust.
ctypedef struct OwnedSlice_i32:
uintptr_t len;
int32_t *ptr;
cdef enum:
Bar_u32,
Polygon1_u32,
Slice1_u32,
Slice2_u32,
Slice3_u32,
Slice4_u32,
ctypedef uint8_t Foo_u32_Tag;
ctypedef struct Slice3_Body_u32:
FillRule fill;
OwnedSlice_u32 coords;
ctypedef struct Slice4_Body_u32:
FillRule fill;
OwnedSlice_i32 coords;
ctypedef struct Foo_u32:
Foo_u32_Tag tag;
Polygon_u32 polygon1;
OwnedSlice_u32 slice1;
OwnedSlice_i32 slice2;
Slice3_Body_u32 slice3;
Slice4_Body_u32 slice4;
ctypedef struct Polygon_i32:
FillRule fill;
OwnedSlice_i32 coordinates;
cdef enum:
Bar2_i32,
Polygon21_i32,
Slice21_i32,
Slice22_i32,
Slice23_i32,
Slice24_i32,
ctypedef uint8_t Baz_i32_Tag;
ctypedef struct Slice23_Body_i32:
Baz_i32_Tag tag;
FillRule fill;
OwnedSlice_i32 coords;
ctypedef struct Slice24_Body_i32:
Baz_i32_Tag tag;
FillRule fill;
OwnedSlice_i32 coords;
ctypedef union Baz_i32:
Baz_i32_Tag tag;
Polygon_i32 polygon21;
OwnedSlice_i32 slice21;
OwnedSlice_i32 slice22;
Slice23_Body_i32 slice23;
Slice24_Body_i32 slice24;
cdef enum:
Bar3,
Taz1,
Taz3,
ctypedef uint8_t Taz_Tag;
ctypedef union Taz:
Taz_Tag tag;
int32_t taz1;
OwnedSlice_i32 taz3;
cdef enum:
Bar4,
Taz2,
ctypedef uint8_t Tazz_Tag;
ctypedef union Tazz:
Tazz_Tag tag;
int32_t taz2;
cdef enum:
Bar5,
Taz5,
ctypedef uint8_t Tazzz_Tag;
ctypedef union Tazzz:
Tazzz_Tag tag;
int32_t taz5;
cdef enum:
Taz6,
Taz7,
ctypedef uint8_t Tazzzz_Tag;
ctypedef union Tazzzz:
Tazzzz_Tag tag;
int32_t taz6;
uint32_t taz7;
cdef enum:
Qux1,
Qux2,
ctypedef uint8_t Qux_Tag;
ctypedef union Qux:
Qux_Tag tag;
int32_t qux1;
uint32_t qux2;
void root(const Foo_u32 *a,
const Baz_i32 *b,
const Taz *c,
Tazz d,
const Tazzz *e,
const Tazzzz *f,
const Qux *g);