1 #include <stdarg.h> 2 #include <stdbool.h> 3 #include <stdint.h> 4 #include <stdlib.h> 5 6 typedef enum MyCLikeEnum { 7 Foo1, 8 Bar1, 9 Baz1, 10 } MyCLikeEnum; 11 12 typedef enum MyCLikeEnum_Prepended { 13 Foo1_Prepended, 14 Bar1_Prepended, 15 Baz1_Prepended, 16 } MyCLikeEnum_Prepended; 17 18 typedef struct MyFancyStruct { 19 int32_t i; 20 #ifdef __cplusplus 21 inline void foo(); 22 #endif 23 } MyFancyStruct; 24 25 typedef enum MyFancyEnum_Tag { 26 Foo, 27 Bar, 28 Baz, 29 } MyFancyEnum_Tag; 30 31 typedef struct MyFancyEnum { 32 MyFancyEnum_Tag tag; 33 union { 34 struct { 35 int32_t bar; 36 }; 37 struct { 38 int32_t baz; 39 }; 40 }; 41 #ifdef __cplusplus 42 inline void wohoo(); 43 #endif 44 } MyFancyEnum; 45 46 typedef union MyUnion { 47 float f; 48 uint32_t u; 49 int32_t extra_member; 50 } MyUnion; 51 52 typedef struct MyFancyStruct_Prepended { 53 #ifdef __cplusplus 54 inline void prepended_wohoo(); 55 #endif 56 int32_t i; 57 } MyFancyStruct_Prepended; 58 59 typedef enum MyFancyEnum_Prepended_Tag { 60 Foo_Prepended, 61 Bar_Prepended, 62 Baz_Prepended, 63 } MyFancyEnum_Prepended_Tag; 64 65 typedef struct MyFancyEnum_Prepended { 66 #ifdef __cplusplus 67 inline void wohoo(); 68 #endif 69 MyFancyEnum_Prepended_Tag tag; 70 union { 71 struct { 72 int32_t bar_prepended; 73 }; 74 struct { 75 int32_t baz_prepended; 76 }; 77 }; 78 } MyFancyEnum_Prepended; 79 80 typedef union MyUnion_Prepended { 81 int32_t extra_member; 82 float f; 83 uint32_t u; 84 } MyUnion_Prepended; 85 86 #ifdef __cplusplus 87 extern "C" { 88 #endif // __cplusplus 89 90 void root(struct MyFancyStruct s, 91 struct MyFancyEnum e, 92 enum MyCLikeEnum c, 93 union MyUnion u, 94 struct MyFancyStruct_Prepended sp, 95 struct MyFancyEnum_Prepended ep, 96 enum MyCLikeEnum_Prepended cp, 97 union MyUnion_Prepended up); 98 99 #ifdef __cplusplus 100 } // extern "C" 101 #endif // __cplusplus 102