2222RE_DEFINE_TRUNCATE = re .compile (r"(#define\s+\w+\s+).+$" , flags = re .DOTALL )
2323RE_TYPEDEF_TRUNCATE = re .compile (r"(typedef\s+\w+\s+\w+)\s*{.*\n}(?=.*;$)" , flags = re .DOTALL | re .MULTILINE )
2424RE_ENUM_TRUNCATE = re .compile (r"(\w+\s*=).+?(?=,$|})(?![^(']*\))" , re .MULTILINE | re .DOTALL )
25+ RE_EVENT_PADDING = re .compile (r"Uint8 padding\[[^]]+\];" , re .MULTILINE | re .DOTALL )
2526
2627
2728def get_header (name : str ) -> str :
@@ -76,6 +77,7 @@ def parse(header: str, NEEDS_PACK4: bool) -> Iterator[str]:
7677
7778 typedef = typedef .replace ("SDLCALL" , " " )
7879 typedef = typedef .replace ("SDL_AUDIOCVT_PACKED " , "" )
80+ typedef = RE_EVENT_PADDING .sub ("Uint8 padding[...];" , typedef )
7981
8082 if NEEDS_PACK4 and "typedef struct SDL_AudioCVT" in typedef :
8183 typedef = RE_TYPEDEF_TRUNCATE .sub (r"\1 { ...; }" , typedef )
@@ -93,8 +95,9 @@ def parse(header: str, NEEDS_PACK4: bool) -> Iterator[str]:
9395 if "va_list" in decl :
9496 continue
9597 decl = re .sub (r"SDL_PRINTF_VARARG_FUNC\(\w*\)" , "" , decl )
96- decl = decl .replace ("extern DECLSPEC " , "" )
97- decl = decl .replace ("SDLCALL" , " " )
98+ decl = decl .replace ("SDL_DEPRECATED" , "" )
99+ decl = decl .replace ("SDLCALL" , "" )
100+ decl = re .sub (r"extern\s+DECLSPEC" , "" , decl )
98101 yield decl .replace ("SDL_PRINTF_FORMAT_STRING " , "" )
99102
100103
0 commit comments