1 #include <stdarg.h> 2 #include <stdbool.h> 3 #include <stdint.h> 4 #include <stdlib.h> 5 6 enum FillRule 7 #ifdef __cplusplus 8 : uint8_t 9 #endif // __cplusplus 10 { 11 A, 12 B, 13 }; 14 #ifndef __cplusplus 15 typedef uint8_t FillRule; 16 #endif // __cplusplus 17 18 /** 19 * This will have a destructor manually implemented via variant_body, and 20 * similarly a Drop impl in Rust. 21 */ 22 typedef struct OwnedSlice_u32 { 23 uintptr_t len; 24 uint32_t *ptr; 25 } OwnedSlice_u32; 26 27 typedef struct Polygon_u32 { 28 FillRule fill; 29 OwnedSlice_u32 coordinates; 30 } Polygon_u32; 31 32 /** 33 * This will have a destructor manually implemented via variant_body, and 34 * similarly a Drop impl in Rust. 35 */ 36 typedef struct OwnedSlice_i32 { 37 uintptr_t len; 38 int32_t *ptr; 39 } OwnedSlice_i32; 40 41 enum Foo_u32_Tag 42 #ifdef __cplusplus 43 : uint8_t 44 #endif // __cplusplus 45 { 46 Bar_u32, 47 Polygon1_u32, 48 Slice1_u32, 49 Slice2_u32, 50 Slice3_u32, 51 Slice4_u32, 52 }; 53 #ifndef __cplusplus 54 typedef uint8_t Foo_u32_Tag; 55 #endif // __cplusplus 56 57 typedef struct Polygon1_Body_u32 { 58 Polygon_u32 _0; 59 } Polygon1_Body_u32; 60 61 typedef struct Slice1_Body_u32 { 62 OwnedSlice_u32 _0; 63 } Slice1_Body_u32; 64 65 typedef struct Slice2_Body_u32 { 66 OwnedSlice_i32 _0; 67 } Slice2_Body_u32; 68 69 typedef struct Slice3_Body_u32 { 70 FillRule fill; 71 OwnedSlice_u32 coords; 72 } Slice3_Body_u32; 73 74 typedef struct Slice4_Body_u32 { 75 FillRule fill; 76 OwnedSlice_i32 coords; 77 } Slice4_Body_u32; 78 79 typedef struct Foo_u32 { 80 Foo_u32_Tag tag; 81 union { 82 Polygon1_Body_u32 polygon1; 83 Slice1_Body_u32 slice1; 84 Slice2_Body_u32 slice2; 85 Slice3_Body_u32 slice3; 86 Slice4_Body_u32 slice4; 87 }; 88 } Foo_u32; 89 90 typedef struct Polygon_i32 { 91 FillRule fill; 92 OwnedSlice_i32 coordinates; 93 } Polygon_i32; 94 95 enum Baz_i32_Tag 96 #ifdef __cplusplus 97 : uint8_t 98 #endif // __cplusplus 99 { 100 Bar2_i32, 101 Polygon21_i32, 102 Slice21_i32, 103 Slice22_i32, 104 Slice23_i32, 105 Slice24_i32, 106 }; 107 #ifndef __cplusplus 108 typedef uint8_t Baz_i32_Tag; 109 #endif // __cplusplus 110 111 typedef struct Polygon21_Body_i32 { 112 Baz_i32_Tag tag; 113 Polygon_i32 _0; 114 } Polygon21_Body_i32; 115 116 typedef struct Slice21_Body_i32 { 117 Baz_i32_Tag tag; 118 OwnedSlice_i32 _0; 119 } Slice21_Body_i32; 120 121 typedef struct Slice22_Body_i32 { 122 Baz_i32_Tag tag; 123 OwnedSlice_i32 _0; 124 } Slice22_Body_i32; 125 126 typedef struct Slice23_Body_i32 { 127 Baz_i32_Tag tag; 128 FillRule fill; 129 OwnedSlice_i32 coords; 130 } Slice23_Body_i32; 131 132 typedef struct Slice24_Body_i32 { 133 Baz_i32_Tag tag; 134 FillRule fill; 135 OwnedSlice_i32 coords; 136 } Slice24_Body_i32; 137 138 typedef union Baz_i32 { 139 Baz_i32_Tag tag; 140 Polygon21_Body_i32 polygon21; 141 Slice21_Body_i32 slice21; 142 Slice22_Body_i32 slice22; 143 Slice23_Body_i32 slice23; 144 Slice24_Body_i32 slice24; 145 } Baz_i32; 146 147 enum Taz_Tag 148 #ifdef __cplusplus 149 : uint8_t 150 #endif // __cplusplus 151 { 152 Bar3, 153 Taz1, 154 Taz3, 155 }; 156 #ifndef __cplusplus 157 typedef uint8_t Taz_Tag; 158 #endif // __cplusplus 159 160 typedef struct Taz1_Body { 161 Taz_Tag tag; 162 int32_t _0; 163 } Taz1_Body; 164 165 typedef struct Taz3_Body { 166 Taz_Tag tag; 167 OwnedSlice_i32 _0; 168 } Taz3_Body; 169 170 typedef union Taz { 171 Taz_Tag tag; 172 Taz1_Body taz1; 173 Taz3_Body taz3; 174 } Taz; 175 176 enum Tazz_Tag 177 #ifdef __cplusplus 178 : uint8_t 179 #endif // __cplusplus 180 { 181 Bar4, 182 Taz2, 183 }; 184 #ifndef __cplusplus 185 typedef uint8_t Tazz_Tag; 186 #endif // __cplusplus 187 188 typedef struct Taz2_Body { 189 Tazz_Tag tag; 190 int32_t _0; 191 } Taz2_Body; 192 193 typedef union Tazz { 194 Tazz_Tag tag; 195 Taz2_Body taz2; 196 } Tazz; 197 198 #ifdef __cplusplus 199 extern "C" { 200 #endif // __cplusplus 201 202 void root(const Foo_u32 *a, const Baz_i32 *b, const Taz *c, Tazz d); 203 204 #ifdef __cplusplus 205 } // extern "C" 206 #endif // __cplusplus 207