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