text:
# Automatically generated using Clang.jl wrap_c, version 0.0.0
# \$\(Expr\(:typealias, :(.+), :\((.+)\)\)\) -> const $1 = $2

using Compat

const OBJC_NEW_PROPERTIES = 1

# Skipping MacroDefinition: DEPRECATED __attribute__ ( ( deprecated ) )
# Skipping MacroDefinition: UNUSED __attribute__ ( ( unused ) )
# Skipping MacroDefinition: DECLSPEC __attribute__ ( ( visibility ( "default" ) ) )
# Skipping MacroDefinition: FORCE_INLINE __attribute__ ( ( always_inline ) ) static __inline__

const SIZEOF_VOIDP = 8
const HAVE_ALLOCA_H = 1
const HAVE_SYS_TYPES_H = 1
const HAVE_STDIO_H = 1
const STDC_HEADERS = 1
const HAVE_STRING_H = 1
const HAVE_INTTYPES_H = 1
const HAVE_STDINT_H = 1
const HAVE_CTYPE_H = 1
const HAVE_MATH_H = 1
const HAVE_SIGNAL_H = 1
const HAVE_MALLOC = 1
const HAVE_CALLOC = 1
const HAVE_REALLOC = 1
const HAVE_FREE = 1
const HAVE_ALLOCA = 1
const HAVE_GETENV = 1
const HAVE_SETENV = 1
const HAVE_PUTENV = 1
const HAVE_UNSETENV = 1
const HAVE_QSORT = 1
const HAVE_ABS = 1
const HAVE_BCOPY = 1
const HAVE_MEMSET = 1
const HAVE_MEMCPY = 1
const HAVE_MEMMOVE = 1
const HAVE_MEMCMP = 1
const HAVE_STRLEN = 1
const HAVE_STRLCPY = 1
const HAVE_STRLCAT = 1
const HAVE_STRDUP = 1
const HAVE_STRCHR = 1
const HAVE_STRRCHR = 1
const HAVE_STRSTR = 1
const HAVE_STRTOL = 1
const HAVE_STRTOUL = 1
const HAVE_STRTOLL = 1
const HAVE_STRTOULL = 1
const HAVE_STRTOD = 1
const HAVE_ATOI = 1
const HAVE_ATOF = 1
const HAVE_STRCMP = 1
const HAVE_STRNCMP = 1
const HAVE_STRCASECMP = 1
const HAVE_STRNCASECMP = 1
const HAVE_VSSCANF = 1
const HAVE_VSNPRINTF = 1
const HAVE_CEIL = 1
const HAVE_COPYSIGN = 1
const HAVE_COS = 1
const HAVE_COSF = 1
const HAVE_FABS = 1
const HAVE_FLOOR = 1
const HAVE_LOG = 1
const HAVE_POW = 1
const HAVE_SCALBN = 1
const HAVE_SIN = 1
const HAVE_SINF = 1
const HAVE_SQRT = 1
const HAVE_SQRTF = 1
const HAVE_TAN = 1
const HAVE_TANF = 1
const HAVE_SIGACTION = 1
const HAVE_SETJMP = 1
const HAVE_NANOSLEEP = 1
const HAVE_SYSCONF = 1
const HAVE_SYSCTLBYNAME = 1
const HAVE_ATAN = 1
const HAVE_ATAN2 = 1
const HAVE_ACOS = 1
const HAVE_ASIN = 1
const AUDIO_DRIVER_COREAUDIO = 1
const AUDIO_DRIVER_DISK = 1
const AUDIO_DRIVER_DUMMY = 1
const JOYSTICK_IOKIT = 1
const HAPTIC_IOKIT = 1
const LOADSO_DLOPEN = 1
const THREAD_PTHREAD = 1
const THREAD_PTHREAD_RECURSIVE_MUTEX = 1
const TIMER_UNIX = 1
const VIDEO_DRIVER_COCOA = 1
const VIDEO_DRIVER_DUMMY = 1
const VIDEO_DRIVER_X11_DYNAMIC = "/usr/X11R6/lib/libX11.6.dylib"
const VIDEO_DRIVER_X11_DYNAMIC_XEXT = "/usr/X11R6/lib/libXext.6.dylib"
const VIDEO_DRIVER_X11_DYNAMIC_XINERAMA = "/usr/X11R6/lib/libXinerama.1.dylib"
const VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 = "/usr/X11R6/lib/libXi.6.dylib"
const VIDEO_DRIVER_X11_DYNAMIC_XRANDR = "/usr/X11R6/lib/libXrandr.2.dylib"
const VIDEO_DRIVER_X11_DYNAMIC_XSS = "/usr/X11R6/lib/libXss.1.dylib"
const VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE = "/usr/X11R6/lib/libXxf86vm.1.dylib"
const VIDEO_DRIVER_X11_XDBE = 1
const VIDEO_DRIVER_X11_XINERAMA = 1
const VIDEO_DRIVER_X11_XRANDR = 1
const VIDEO_DRIVER_X11_XSCRNSAVER = 1
const VIDEO_DRIVER_X11_XSHAPE = 1
const VIDEO_DRIVER_X11_XVIDMODE = 1
const VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM = 1
const VIDEO_RENDER_OGL = 1
const VIDEO_OPENGL = 1
const VIDEO_OPENGL_CGL = 1
const VIDEO_OPENGL_GLX = 1
const POWER_MACOSX = 1
const FILESYSTEM_COCOA = 1
const ASSEMBLY_ROUTINES = 1

# Skipping MacroDefinition: NULL ( ( void * ) 0 )
# Skipping MacroDefinition: offsetof ( t , d ) __builtin_offsetof ( t , d )
# Skipping MacroDefinition: va_start ( ap , param ) __builtin_va_start ( ap , param )
# Skipping MacroDefinition: va_end ( ap ) __builtin_va_end ( ap )
# Skipping MacroDefinition: va_arg ( ap , type ) __builtin_va_arg ( ap , type )
# Skipping MacroDefinition: va_copy ( dest , src ) __builtin_va_copy ( dest , src )
# Skipping MacroDefinition: arraysize ( array ) ( sizeof ( array ) / sizeof ( array [ 0 ] ) )
# Skipping MacroDefinition: TABLESIZE ( table ) arraysize ( table )
# Skipping MacroDefinition: STRINGIFY_ARG ( arg ) # arg
# Skipping MacroDefinition: reinterpret_cast ( type , expression ) ( ( type ) ( expression ) )
# Skipping MacroDefinition: static_cast ( type , expression ) ( ( type ) ( expression ) )
# Skipping MacroDefinition: const_cast ( type , expression ) ( ( type ) ( expression ) )
# Skipping MacroDefinition: FOURCC ( A , B , C , D ) ( ( static_cast ( Uint32 , static_cast ( Uint8 , ( A ) ) ) << 0 ) | ( static_cast ( Uint32 , static_cast ( Uint8 , ( B ) ) ) << 8 ) | ( static_cast ( Uint32 , static_cast ( Uint8 , ( C ) ) ) << 16 ) | ( static_cast ( Uint32 , static_cast ( Uint8 , ( D ) ) ) << 24 ) )

const PRIs64 = "lld"
const PRIu64 = "llu"
const PRIx64 = "llx"
const PRIX64 = "llX"

#const IN_BYTECAP = x
#const INOUT_Z_CAP = x
#const OUT_Z_CAP = x
#const OUT_CAP = x
#const OUT_BYTECAP = x
#const OUT_Z_BYTECAP = x

# Skipping MacroDefinition: PRINTF_VARARG_FUNC ( fmtargnumber ) __attribute__ ( ( format ( __printf__ , fmtargnumber , fmtargnumber + 1 ) ) )
# Skipping MacroDefinition: SCANF_VARARG_FUNC ( fmtargnumber ) __attribute__ ( ( format ( __scanf__ , fmtargnumber , fmtargnumber + 1 ) ) )
# Skipping MacroDefinition: COMPILE_TIME_ASSERT ( name , x ) typedef int dummy_ ## name [ ( x ) * 2 - 1 ]
# Skipping MacroDefinition: stack_alloc ( type , count ) ( type * ) alloca ( sizeof ( type ) * ( count ) )

#const stack_free = data

# Skipping MacroDefinition: min ( x , y ) ( ( ( x ) < ( y ) ) ? ( x ) : ( y ) )
# Skipping MacroDefinition: max ( x , y ) ( ( ( x ) > ( y ) ) ? ( x ) : ( y ) )
# Skipping MacroDefinition: zero ( x ) memset ( & ( x ) , 0 , sizeof ( ( x ) ) )
# Skipping MacroDefinition: zerop ( x ) memset ( ( x ) , 0 , sizeof ( * ( x ) ) )

const M_PI = 3.141592653589793

# Skipping MacroDefinition: ICONV_ERROR ( size_t ) - 1
# Skipping MacroDefinition: ICONV_E2BIG ( size_t ) - 2
# Skipping MacroDefinition: ICONV_EILSEQ ( size_t ) - 3
# Skipping MacroDefinition: ICONV_EINVAL ( size_t ) - 4
# Skipping MacroDefinition: iconv_utf8_locale ( S ) iconv_string ( "" , "UTF-8" , S , strlen ( S ) + 1 )
# Skipping MacroDefinition: iconv_utf8_ucs2 ( S ) ( Uint16 * ) iconv_string ( "UCS-2-INTERNAL" , "UTF-8" , S , strlen ( S ) + 1 )
# Skipping MacroDefinition: iconv_utf8_ucs4 ( S ) ( Uint32 * ) iconv_string ( "UCS-4-INTERNAL" , "UTF-8" , S , strlen ( S ) + 1 )

const ASSERT_LEVEL = 2

# Skipping MacroDefinition: TriggerBreakpoint ( ) __asm__ __volatile__ ( "int $3\n\t" )

#const FILE = __FILE__
#const LINE = __LINE__
const NULL_WHILE_LOOP_CONDITION = 0

# Skipping MacroDefinition: disabled_assert ( condition ) do { ( void ) sizeof ( ( condition ) ) ; } while ( NULL_WHILE_LOOP_CONDITION )
# Skipping MacroDefinition: enabled_assert ( condition ) do { while ( ! ( condition ) ) { static struct AssertData assert_data = { 0 , 0 , # condition , 0 , 0 , 0 , 0 } ; const AssertState assert_state = ReportAssertion ( & assert_data , FUNCTION , FILE , LINE ) ; if ( assert_state == ASSERTION_RETRY ) { continue ; /* go again. */ } else if ( assert_state == ASSERTION_BREAK ) { TriggerBreakpoint ( ) ; } break ; /* not retrying. */ } } while ( NULL_WHILE_LOOP_CONDITION )
# Skipping MacroDefinition: assert ( condition ) enabled_assert ( condition )
# Skipping MacroDefinition: assert_release ( condition ) enabled_assert ( condition )
# Skipping MacroDefinition: assert_paranoid ( condition ) disabled_assert ( condition )
# Skipping MacroDefinition: assert_always ( condition ) enabled_assert ( condition )

# const AssertState = Cvoid
# const assert_state = AssertState

mutable struct AssertData
    always_ignore::Cint
    trigger_count::UInt32
    condition::Cstring
    filename::Cstring
    linenum::Cint
    _function::Cstring
    next::Ptr{Cvoid}
end

const assert_data = AssertData

# Skipping MacroDefinition: CompilerBarrier ( ) __asm__ __volatile__ ( "" : : : "memory" )
# Skipping MacroDefinition: MemoryBarrierRelease ( ) CompilerBarrier ( )
# Skipping MacroDefinition: MemoryBarrierAcquire ( ) CompilerBarrier ( )
# Skipping MacroDefinition: AtomicIncRef ( a ) AtomicAdd ( a , 1 )
# Skipping MacroDefinition: AtomicDecRef ( a ) ( AtomicAdd ( a , - 1 ) == 1 )
# Skipping MacroDefinition: OutOfMemory ( ) Error ( ENOMEM )
# Skipping MacroDefinition: Unsupported ( ) Error ( UNSUPPORTED )
# Skipping MacroDefinition: InvalidParamError ( param ) SetError ( "Parameter '%s' is invalid" , ( param ) )

const LIL_ENDIAN = 1234
const BIG_ENDIAN = 4321
const BYTEORDER = LIL_ENDIAN

# Skipping MacroDefinition: SwapLE16 ( X ) ( X )
# Skipping MacroDefinition: SwapLE32 ( X ) ( X )
# Skipping MacroDefinition: SwapLE64 ( X ) ( X )
# Skipping MacroDefinition: SwapFloatLE ( X ) ( X )
# Skipping MacroDefinition: SwapBE16 ( X ) Swap16 ( X )
# Skipping MacroDefinition: SwapBE32 ( X ) Swap32 ( X )
# Skipping MacroDefinition: SwapBE64 ( X ) Swap64 ( X )
# Skipping MacroDefinition: SwapFloatBE ( X ) SwapFloat ( X )

const MUTEX_TIMEDOUT = 1

# Skipping MacroDefinition: MUTEX_MAXWAIT ( ~ ( Uint32 ) 0 )
# Skipping MacroDefinition: mutexP ( m ) LockMutex ( m )
# Skipping MacroDefinition: mutexV ( m ) UnlockMutex ( m )

const RWOPS_UNKNOWN = UInt32(0)
const RWOPS_WINFILE = UInt32(1)
const RWOPS_STDFILE = UInt32(2)
const RWOPS_JNIFILE = UInt32(3)
const RWOPS_MEMORY = UInt32(4)
const RWOPS_MEMORY_RO = UInt32(5)
const RW_SEEK_SET = 0
const RW_SEEK_CUR = 1
const RW_SEEK_END = 2

# Skipping MacroDefinition: RWsize ( ctx ) ( ctx ) -> size ( ctx )
# Skipping MacroDefinition: RWseek ( ctx , offset , whence ) ( ctx ) -> seek ( ctx , offset , whence )
# Skipping MacroDefinition: RWtell ( ctx ) ( ctx ) -> seek ( ctx , 0 , RW_SEEK_CUR )
# Skipping MacroDefinition: RWread ( ctx , ptr , size , n ) ( ctx ) -> read ( ctx , ptr , size , n )
# Skipping MacroDefinition: RWwrite ( ctx , ptr , size , n ) ( ctx ) -> write ( ctx , ptr , size , n )
# Skipping MacroDefinition: RWclose ( ctx ) ( ctx ) -> close ( ctx )

const AUDIO_MASK_BITSIZE = Float32(0x0f)
const AUDIO_MASK_DATATYPE = 1 << 8
const AUDIO_MASK_ENDIAN = 1 << 12
const AUDIO_MASK_SIGNED = 1 << 15

# Skipping MacroDefinition: AUDIO_BITSIZE ( x ) ( x & AUDIO_MASK_BITSIZE )
# Skipping MacroDefinition: AUDIO_ISFLOAT ( x ) ( x & AUDIO_MASK_DATATYPE )
# Skipping MacroDefinition: AUDIO_ISBIGENDIAN ( x ) ( x & AUDIO_MASK_ENDIAN )
# Skipping MacroDefinition: AUDIO_ISSIGNED ( x ) ( x & AUDIO_MASK_SIGNED )
# Skipping MacroDefinition: AUDIO_ISINT ( x ) ( ! AUDIO_ISFLOAT ( x ) )
# Skipping MacroDefinition: AUDIO_ISLITTLEENDIAN ( x ) ( ! AUDIO_ISBIGENDIAN ( x ) )
# Skipping MacroDefinition: AUDIO_ISUNSIGNED ( x ) ( ! AUDIO_ISSIGNED ( x ) )

const AUDIO_U8 = 0x0008
const AUDIO_S8 = 0x8008
const AUDIO_U16LSB = 0x0010
const AUDIO_S16LSB = 0x8010
const AUDIO_U16MSB = 0x1010
const AUDIO_S16MSB = 0x9010
const AUDIO_U16 = AUDIO_U16LSB
const AUDIO_S16 = AUDIO_S16LSB
const AUDIO_S32LSB = 0x8020
const AUDIO_S32MSB = 0x9020
const AUDIO_S32 = AUDIO_S32LSB
const AUDIO_F32LSB = 0x8120
const AUDIO_F32MSB = 0x9120
const AUDIO_F32 = AUDIO_F32LSB
const AUDIO_U16SYS = AUDIO_U16LSB
const AUDIO_S16SYS = AUDIO_S16LSB
const AUDIO_S32SYS = AUDIO_S32LSB
const AUDIO_F32SYS = AUDIO_F32LSB
const AUDIO_ALLOW_FREQUENCY_CHANGE = 0x00000001
const AUDIO_ALLOW_FORMAT_CHANGE = 0x00000002
const AUDIO_ALLOW_CHANNELS_CHANGE = 0x00000004
const AUDIO_ALLOW_ANY_CHANGE = (AUDIO_ALLOW_FREQUENCY_CHANGE | AUDIO_ALLOW_FORMAT_CHANGE) | AUDIO_ALLOW_CHANNELS_CHANGE

# Skipping MacroDefinition: AUDIOCVT_PACKED __attribute__ ( ( packed ) )
# Skipping MacroDefinition: LoadWAV ( file , spec , audio_buf , audio_len ) LoadWAV_RW ( RWFromFile ( file , "rb" ) , 1 , spec , audio_buf , audio_len )

const MIX_MAXVOLUME = 128
const CACHELINE_SIZE = 128
const ALPHA_OPAQUE = 255
const ALPHA_TRANSPARENT = 0

# Skipping MacroDefinition: DEFINE_PIXELFOURCC ( A , B , C , D ) FOURCC ( A , B , C , D )
# Skipping MacroDefinition: DEFINE_PIXELFORMAT ( type , order , layout , bits , bytes ) ( ( 1 << 28 ) | ( ( type ) << 24 ) | ( ( order ) << 20 ) | ( ( layout ) << 16 ) | ( ( bits ) << 8 ) | ( ( bytes ) << 0 ) )
# Skipping MacroDefinition: PIXELFLAG ( X ) ( ( ( X ) >> 28 ) & 0x0F )
# Skipping MacroDefinition: PIXELTYPE ( X ) ( ( ( X ) >> 24 ) & 0x0F )
# Skipping MacroDefinition: PIXELORDER ( X ) ( ( ( X ) >> 20 ) & 0x0F )
# Skipping MacroDefinition: PIXELLAYOUT ( X ) ( ( ( X ) >> 16 ) & 0x0F )
# Skipping MacroDefinition: BITSPERPIXEL ( X ) ( ( ( X ) >> 8 ) & 0xFF )
# Skipping MacroDefinition: BYTESPERPIXEL ( X ) ( ISPIXELFORMAT_FOURCC ( X ) ? ( ( ( ( X ) == PIXELFORMAT_YUY2 ) || ( ( X ) == PIXELFORMAT_UYVY ) || ( ( X ) == PIXELFORMAT_YVYU ) ) ? 2 : 1 ) : ( ( ( X ) >> 0 ) & 0xFF ) )
# Skipping MacroDefinition: ISPIXELFORMAT_INDEXED ( format ) ( ! ISPIXELFORMAT_FOURCC ( format ) && ( ( PIXELTYPE ( format ) == PIXELTYPE_INDEX1 ) || ( PIXELTYPE ( format ) == PIXELTYPE_INDEX4 ) || ( PIXELTYPE ( format ) == PIXELTYPE_INDEX8 ) ) )
# Skipping MacroDefinition: ISPIXELFORMAT_PACKED ( format ) ( ! ISPIXELFORMAT_FOURCC ( format ) && ( ( PIXELTYPE ( format ) == PIXELTYPE_PACKED8 ) || ( PIXELTYPE ( format ) == PIXELTYPE_PACKED16 ) || ( PIXELTYPE ( format ) == PIXELTYPE_PACKED32 ) ) )
# Skipping MacroDefinition: ISPIXELFORMAT_ARRAY ( format ) ( ! ISPIXELFORMAT_FOURCC ( format ) && ( ( PIXELTYPE ( format ) == PIXELTYPE_ARRAYU8 ) || ( PIXELTYPE ( format ) == PIXELTYPE_ARRAYU16 ) || ( PIXELTYPE ( format ) == PIXELTYPE_ARRAYU32 ) || ( PIXELTYPE ( format ) == PIXELTYPE_ARRAYF16 ) || ( PIXELTYPE ( format ) == PIXELTYPE_ARRAYF32 ) ) )
# Skipping MacroDefinition: ISPIXELFORMAT_ALPHA ( format ) ( ( ISPIXELFORMAT_PACKED ( format ) && ( ( PIXELORDER ( format ) == PACKEDORDER_ARGB ) || ( PIXELORDER ( format ) == PACKEDORDER_RGBA ) || ( PIXELORDER ( format ) == PACKEDORDER_ABGR ) || ( PIXELORDER ( format ) == PACKEDORDER_BGRA ) ) ) || ( ISPIXELFORMAT_ARRAY ( format ) && ( ( PIXELORDER ( format ) == ARRAYORDER_ARGB ) || ( PIXELORDER ( format ) == ARRAYORDER_RGBA ) || ( PIXELORDER ( format ) == ARRAYORDER_ABGR ) || ( PIXELORDER ( format ) == ARRAYORDER_BGRA ) ) ) )
# Skipping MacroDefinition: ISPIXELFORMAT_FOURCC ( format ) ( ( format ) && ( PIXELFLAG ( format ) != 1 ) )

#const Uint8 = Cint
const Uint8 = Cuchar

mutable struct Color
    r::Uint8
    g::Uint8
    b::Uint8
    a::Uint8
end

const Colour = Color
const SWSURFACE = 0
const PREALLOC = 0x00000001
const RLEACCEL = 0x00000002
const DONTFREE = 0x00000004

#const BlitSurface = UpperBlit
#const BlitScaled = UpperBlitScaled
const WINDOWPOS_UNDEFINED_MASK = UInt32(0x1fff0000)

# Skipping MacroDefinition: WINDOWPOS_UNDEFINED_DISPLAY ( X ) ( WINDOWPOS_UNDEFINED_MASK | ( X ) )
# Skipping MacroDefinition: WINDOWPOS_UNDEFINED WINDOWPOS_UNDEFINED_DISPLAY ( 0 )
# Skipping MacroDefinition: WINDOWPOS_ISUNDEFINED ( X ) ( ( ( X ) & 0xFFFF0000 ) == WINDOWPOS_UNDEFINED_MASK )

const WINDOWPOS_CENTERED_MASK = UInt32(0x2fff0000)

# Macro definitions
WINDOWPOS_CENTERED_DISPLAY(X) = ( WINDOWPOS_CENTERED_MASK | (X) )
WINDOWPOS_CENTERED() = WINDOWPOS_CENTERED_DISPLAY(0)
WINDOWPOS_ISCENTERED(X) = ( ( (X) & 0xFFFF0000 ) == WINDOWPOS_CENTERED_MASK )

const SDLK_SCANCODE_MASK = 1 << 30

SCANCODE_TO_KEYCODE(X) = (X | SDLK_SCANCODE_MASK)

# begin enum ANONYMOUS_23
const ANONYMOUS_23 = UInt32
const KMOD_NONE = (UInt32)(0x0000)
const KMOD_LSHIFT = (UInt32)(0x0001)
const KMOD_RSHIFT = (UInt32)(0x0002)
const KMOD_LCTRL = (UInt32)(0x0040)
const KMOD_RCTRL = (UInt32)(0x0080)
const KMOD_LALT = (UInt32)(0x0100)
const KMOD_RALT = (UInt32)(0x0200)
const KMOD_LGUI = (UInt32)(0x0400)
const KMOD_RGUI = (UInt32)(0x0800)
const KMOD_NUM = (UInt32)(0x1000)
const KMOD_CAPS = (UInt32)(0x2000)
const KMOD_MODE = (UInt32)(0x4000)
const KMOD_RESERVED = (UInt32)(0x8000)
# end enum ANONYMOUS_23

const KMOD_CTRL = KMOD_LCTRL | KMOD_RCTRL
const KMOD_SHIFT = KMOD_LSHIFT | KMOD_RSHIFT
const KMOD_ALT = KMOD_LALT | KMOD_RALT
const KMOD_GUI = KMOD_LGUI | KMOD_RGUI

const Keymod = UInt32

# Skipping MacroDefinition: BUTTON ( X ) ( 1 << ( ( X ) - 1 ) )

const BUTTON_LEFT = 1
const BUTTON_MIDDLE = 2
const BUTTON_RIGHT = 3
const BUTTON_X1 = 4
const BUTTON_X2 = 5

# Skipping MacroDefinition: BUTTON_LMASK BUTTON ( BUTTON_LEFT )
# Skipping MacroDefinition: BUTTON_MMASK BUTTON ( BUTTON_MIDDLE )
# Skipping MacroDefinition: BUTTON_RMASK BUTTON ( BUTTON_RIGHT )
# Skipping MacroDefinition: BUTTON_X1MASK BUTTON ( BUTTON_X1 )
# Skipping MacroDefinition: BUTTON_X2MASK BUTTON ( BUTTON_X2 )

const HAT_CENTERED = 0x00
const HAT_UP = 0x01
const HAT_RIGHT = 0x02
const HAT_DOWN = 0x04
const HAT_LEFT = 0x08
const HAT_RIGHTUP = HAT_RIGHT | HAT_UP
const HAT_RIGHTDOWN = HAT_RIGHT | HAT_DOWN
const HAT_LEFTUP = HAT_LEFT | HAT_UP
const HAT_LEFTDOWN = HAT_LEFT | HAT_DOWN

# Skipping MacroDefinition: GameControllerAddMappingsFromFile ( file ) GameControllerAddMappingsFromRW ( RWFromFile ( file , "rb" ) , 1 )
# Skipping MacroDefinition: QuitRequested ( ) ( PumpEvents ( ) , ( PeepEvents ( NULL , 0 , PEEKEVENT , QUIT , QUIT ) > 0 ) )
# Skipping MacroDefinition: TOUCH_MOUSEID ( ( Uint32 ) - 1 )

const RELEASED = 0
const PRESSED = 1
const TEXTEDITINGEVENT_TEXT_SIZE = 32
const TEXTINPUTEVENT_TEXT_SIZE = 32
const QUERY = -1
const IGNORE = 0
const DISABLE = 0
const ENABLE = 1

# Skipping MacroDefinition: GetEventState ( type ) EventState ( type , QUERY )

const HAPTIC_CONSTANT = UInt32(1) << 0
const HAPTIC_SINE = UInt32(1) << 1
const HAPTIC_LEFTRIGHT = UInt32(1) << 2
const HAPTIC_TRIANGLE = UInt32(1) << 3
const HAPTIC_SAWTOOTHUP = UInt32(1) << 4
const HAPTIC_SAWTOOTHDOWN = UInt32(1) << 5
const HAPTIC_RAMP = UInt32(1) << 6
const HAPTIC_SPRING = UInt32(1) << 7
const HAPTIC_DAMPER = UInt32(1) << 8
const HAPTIC_INERTIA = UInt32(1) << 9
const HAPTIC_FRICTION = UInt32(1) << 10
const HAPTIC_CUSTOM = UInt32(1) << 11
const HAPTIC_GAIN = UInt32(1) << 12
const HAPTIC_AUTOCENTER = UInt32(1) << 13
const HAPTIC_STATUS = UInt32(1) << 14
const HAPTIC_PAUSE = UInt32(1) << 15
const HAPTIC_POLAR = 0
const HAPTIC_CARTESIAN = 1
const HAPTIC_SPHERICAL = 2
const HAPTIC_INFINITY = UInt32(4294967295)
const HINT_FRAMEBUFFER_ACCELERATION = "FRAMEBUFFER_ACCELERATION"
const HINT_RENDER_DRIVER = "RENDER_DRIVER"
const HINT_RENDER_OPENGL_SHADERS = "RENDER_OPENGL_SHADERS"
const HINT_RENDER_DIRECT3D_THREADSAFE = "RENDER_DIRECT3D_THREADSAFE"
const HINT_RENDER_DIRECT3D11_DEBUG = "RENDER_DIRECT3D11_DEBUG"
const HINT_RENDER_SCALE_QUALITY = "RENDER_SCALE_QUALITY"
const HINT_RENDER_VSYNC = "RENDER_VSYNC"
const HINT_VIDEO_ALLOW_SCREENSAVER = "VIDEO_ALLOW_SCREENSAVER"
const HINT_VIDEO_X11_XVIDMODE = "VIDEO_X11_XVIDMODE"
const HINT_VIDEO_X11_XINERAMA = "VIDEO_X11_XINERAMA"
const HINT_VIDEO_X11_XRANDR = "VIDEO_X11_XRANDR"
const HINT_VIDEO_X11_NET_WM_PING = "VIDEO_X11_NET_WM_PING"
const HINT_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN = "WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN"
const HINT_WINDOWS_ENABLE_MESSAGELOOP = "WINDOWS_ENABLE_MESSAGELOOP"
const HINT_GRAB_KEYBOARD = "GRAB_KEYBOARD"
const HINT_MOUSE_RELATIVE_MODE_WARP = "MOUSE_RELATIVE_MODE_WARP"
const HINT_MOUSE_FOCUS_CLICKTHROUGH = "MOUSE_FOCUS_CLICKTHROUGH"
const HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS = "VIDEO_MINIMIZE_ON_FOCUS_LOSS"
const HINT_IDLE_TIMER_DISABLED = "IOS_IDLE_TIMER_DISABLED"
const HINT_ORIENTATIONS = "IOS_ORIENTATIONS"
const HINT_APPLE_TV_CONTROLLER_UI_EVENTS = "APPLE_TV_CONTROLLER_UI_EVENTS"
const HINT_APPLE_TV_REMOTE_ALLOW_ROTATION = "APPLE_TV_REMOTE_ALLOW_ROTATION"
const HINT_ACCELEROMETER_AS_JOYSTICK = "ACCELEROMETER_AS_JOYSTICK"
const HINT_XINPUT_ENABLED = "XINPUT_ENABLED"
const HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING = "XINPUT_USE_OLD_JOYSTICK_MAPPING"
const HINT_GAMECONTROLLERCONFIG = "GAMECONTROLLERCONFIG"
const HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS = "JOYSTICK_ALLOW_BACKGROUND_EVENTS"
const HINT_ALLOW_TOPMOST = "ALLOW_TOPMOST"
const HINT_TIMER_RESOLUTION = "TIMER_RESOLUTION"
const HINT_THREAD_STACK_SIZE = "THREAD_STACK_SIZE"
const HINT_VIDEO_HIGHDPI_DISABLED = "VIDEO_HIGHDPI_DISABLED"
const HINT_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK = "MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK"
const HINT_VIDEO_WIN_D3DCOMPILER = "VIDEO_WIN_D3DCOMPILER"
const HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT = "VIDEO_WINDOW_SHARE_PIXEL_FORMAT"
const HINT_WINRT_PRIVACY_POLICY_URL = "WINRT_PRIVACY_POLICY_URL"
const HINT_WINRT_PRIVACY_POLICY_LABEL = "WINRT_PRIVACY_POLICY_LABEL"
const HINT_WINRT_HANDLE_BACK_BUTTON = "WINRT_HANDLE_BACK_BUTTON"
const HINT_VIDEO_MAC_FULLSCREEN_SPACES = "VIDEO_MAC_FULLSCREEN_SPACES"
const HINT_MAC_BACKGROUND_APP = "MAC_BACKGROUND_APP"
const HINT_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION = "ANDROID_APK_EXPANSION_MAIN_FILE_VERSION"
const HINT_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION = "ANDROID_APK_EXPANSION_PATCH_FILE_VERSION"
const HINT_IME_INTERNAL_EDITING = "IME_INTERNAL_EDITING"
const HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH = "ANDROID_SEPARATE_MOUSE_AND_TOUCH"
const HINT_EMSCRIPTEN_KEYBOARD_ELEMENT = "EMSCRIPTEN_KEYBOARD_ELEMENT"
const HINT_NO_SIGNAL_HANDLERS = "NO_SIGNAL_HANDLERS"
const HINT_WINDOWS_NO_CLOSE_ON_ALT_F4 = "WINDOWS_NO_CLOSE_ON_ALT_F4"
const HINT_BMP_SAVE_LEGACY_FORMAT = "BMP_SAVE_LEGACY_FORMAT"
const HINT_WINDOWS_DISABLE_THREAD_NAMING = "WINDOWS_DISABLE_THREAD_NAMING"
const HINT_RPI_VIDEO_LAYER = "RPI_VIDEO_LAYER"
const MAX_LOG_MESSAGE = 4096

# Skipping MacroDefinition: TICKS_PASSED ( A , B ) ( ( Sint32 ) ( ( B ) - ( A ) ) <= 0 )

const MAJOR_VERSION = 2
const MINOR_VERSION = 0
const PATCHLEVEL = 5

# Skipping MacroDefinition: VERSION ( x ) \
#{ ( x ) -> major = MAJOR_VERSION ; ( x ) -> minor = MINOR_VERSION ; ( x ) -> patch = PATCHLEVEL ; \
#}
# Skipping MacroDefinition: VERSIONNUM ( X , Y , Z ) ( ( X ) * 1000 + ( Y ) * 100 + ( Z ) )
# Skipping MacroDefinition: COMPILEDVERSION VERSIONNUM ( MAJOR_VERSION , MINOR_VERSION , PATCHLEVEL )
# Skipping MacroDefinition: VERSION_ATLEAST ( X , Y , Z ) ( COMPILEDVERSION >= VERSIONNUM ( X , Y , Z ) )

const INIT_TIMER = UInt32(0x00000001)
const INIT_AUDIO = UInt32(0x00000010)
const INIT_VIDEO = UInt32(0x00000020)
const INIT_JOYSTICK = UInt32(0x00000200)
const INIT_HAPTIC = UInt32(0x00001000)
const INIT_GAMECONTROLLER = UInt32(0x00002000)
const INIT_EVENTS = UInt32(0x00004000)
const INIT_NOPARACHUTE = UInt32(0x00100000)
const INIT_EVERYTHING = (((((INIT_TIMER | INIT_AUDIO) | INIT_VIDEO) | INIT_EVENTS) | INIT_JOYSTICK) | INIT_HAPTIC) | INIT_GAMECONTROLLER

const ptrdiff_t = Clong
const size_t = Culong
const wchar_t = Cint
const max_align_t = Float64
#const va_list = __builtin_va_list

# begin enum ANONYMOUS_1
const ANONYMOUS_1 = UInt32
const FALSE = (UInt32)(0)
const TRUE = (UInt32)(1)
# end enum ANONYMOUS_1

const bool = Bool
const Sint8 = Cchar
const Sint16 = Cshort
const Uint16 = Cushort
const Sint32 = Cint
const Uint32 = Cuint
const Sint64 = Clonglong
const Uint64 = Culonglong
const SDL_dummy_uint8 = Cchar
const SDL_dummy_sint8 = Cuchar
const SDL_dummy_uint16 = Cshort
const SDL_dummy_sint16 = Cushort
const SDL_dummy_uint32 = NTuple{1, Cuint}
const SDL_dummy_sint32 = NTuple{1, Cint}
const SDL_dummy_uint64 = Clonglong
const SDL_dummy_sint64 = Culonglong

# begin enum ANONYMOUS_2
const ANONYMOUS_2 = UInt32
const DUMMY_ENUM_VALUE = (UInt32)(0)
# end enum ANONYMOUS_2

const DUMMY_ENUM = UInt32
const dummy_enum = NTuple{1, Cint}

mutable struct _iconv_t
end

const iconv_t = Ptr{Cvoid}

# begin enum ANONYMOUS_3
const ANONYMOUS_3 = UInt32
const ASSERTION_RETRY = (UInt32)(0)
const ASSERTION_BREAK = (UInt32)(1)
const ASSERTION_ABORT = (UInt32)(2)
const ASSERTION_IGNORE = (UInt32)(3)
const ASSERTION_ALWAYS_IGNORE = (UInt32)(4)
# end enum ANONYMOUS_3

const AssertionHandler = Ptr{Cvoid}
const SpinLock = Cint
const atomic_t = Cvoid

# begin enum ANONYMOUS_4
const ANONYMOUS_4 = UInt32
const ENOMEM = (UInt32)(0)
const EFREAD = (UInt32)(1)
const EFWRITE = (UInt32)(2)
const EFSEEK = (UInt32)(3)
const UNSUPPORTED = (UInt32)(4)
const LASTERROR = (UInt32)(5)
# end enum ANONYMOUS_4

const errorcode = UInt32

mutable struct Mutex
end

mutable struct semaphore
end

const Sem = semaphore

mutable struct Cond
end

mutable struct Thread
end

const SDL_threadID = Culong
const TLSID = UInt32

# begin enum ANONYMOUS_5
const ANONYMOUS_5 = UInt32
const THREAD_PRIORITY_LOW = (UInt32)(0)
const THREAD_PRIORITY_NORMAL = (UInt32)(1)
const THREAD_PRIORITY_HIGH = (UInt32)(2)
# end enum ANONYMOUS_5

const ThreadPriority = UInt32
const ThreadFunction = Ptr{Cvoid}

mutable struct RWops
    size::Ptr{Cvoid}
    seek::Ptr{Cvoid}
    read::Ptr{Cvoid}
    write::Ptr{Cvoid}
    close::Ptr{Cvoid}
    _type::Uint32
    hidden::Cvoid
end

const AudioFormat = Uint16
const AudioCallback = Ptr{Cvoid}

mutable struct AudioSpec
    freq::Cint
    format::AudioFormat
    channels::Uint8
    silence::Uint8
    samples::Uint16
    padding::Uint16
    size::Uint32
    callback::AudioCallback
    userdata::Ptr{Cvoid}
end

const AudioFilter = Ptr{Cvoid}
const AudioDeviceID = Uint32

# begin enum ANONYMOUS_6
const ANONYMOUS_6 = UInt32
const AUDIO_STOPPED = (UInt32)(0)
const AUDIO_PLAYING = (UInt32)(1)
const AUDIO_PAUSED = (UInt32)(2)
# end enum ANONYMOUS_6

const AudioStatus = UInt32

# begin enum ANONYMOUS_7
const ANONYMOUS_7 = UInt32
const PIXELTYPE_UNKNOWN = (UInt32)(0)
const PIXELTYPE_INDEX1 = (UInt32)(1)
const PIXELTYPE_INDEX4 = (UInt32)(2)
const PIXELTYPE_INDEX8 = (UInt32)(3)
const PIXELTYPE_PACKED8 = (UInt32)(4)
const PIXELTYPE_PACKED16 = (UInt32)(5)
const PIXELTYPE_PACKED32 = (UInt32)(6)
const PIXELTYPE_ARRAYU8 = (UInt32)(7)
const PIXELTYPE_ARRAYU16 = (UInt32)(8)
const PIXELTYPE_ARRAYU32 = (UInt32)(9)
const PIXELTYPE_ARRAYF16 = (UInt32)(10)
const PIXELTYPE_ARRAYF32 = (UInt32)(11)
# end enum ANONYMOUS_7

# begin enum ANONYMOUS_8
const ANONYMOUS_8 = UInt32
const BITMAPORDER_NONE = (UInt32)(0)
const BITMAPORDER_4321 = (UInt32)(1)
const BITMAPORDER_1234 = (UInt32)(2)
# end enum ANONYMOUS_8

# begin enum ANONYMOUS_9
const ANONYMOUS_9 = UInt32
const PACKEDORDER_NONE = (UInt32)(0)
const PACKEDORDER_XRGB = (UInt32)(1)
const PACKEDORDER_RGBX = (UInt32)(2)
const PACKEDORDER_ARGB = (UInt32)(3)
const PACKEDORDER_RGBA = (UInt32)(4)
const PACKEDORDER_XBGR = (UInt32)(5)
const PACKEDORDER_BGRX = (UInt32)(6)
const PACKEDORDER_ABGR = (UInt32)(7)
const PACKEDORDER_BGRA = (UInt32)(8)
# end enum ANONYMOUS_9

# begin enum ANONYMOUS_10
const ANONYMOUS_10 = UInt32
const ARRAYORDER_NONE = (UInt32)(0)
const ARRAYORDER_RGB = (UInt32)(1)
const ARRAYORDER_RGBA = (UInt32)(2)
const ARRAYORDER_ARGB = (UInt32)(3)
const ARRAYORDER_BGR = (UInt32)(4)
const ARRAYORDER_BGRA = (UInt32)(5)
const ARRAYORDER_ABGR = (UInt32)(6)
# end enum ANONYMOUS_10

# begin enum ANONYMOUS_11
const ANONYMOUS_11 = UInt32
const PACKEDLAYOUT_NONE = (UInt32)(0)
const PACKEDLAYOUT_332 = (UInt32)(1)
const PACKEDLAYOUT_4444 = (UInt32)(2)
const PACKEDLAYOUT_1555 = (UInt32)(3)
const PACKEDLAYOUT_5551 = (UInt32)(4)
const PACKEDLAYOUT_565 = (UInt32)(5)
const PACKEDLAYOUT_8888 = (UInt32)(6)
const PACKEDLAYOUT_2101010 = (UInt32)(7)
const PACKEDLAYOUT_1010102 = (UInt32)(8)
# end enum ANONYMOUS_11

# begin enum ANONYMOUS_12
const ANONYMOUS_12 = UInt32
const PIXELFORMAT_UNKNOWN = (UInt32)(0)
const PIXELFORMAT_INDEX1LSB = (UInt32)(286261504)
const PIXELFORMAT_INDEX1MSB = (UInt32)(287310080)
const PIXELFORMAT_INDEX4LSB = (UInt32)(303039488)
const PIXELFORMAT_INDEX4MSB = (UInt32)(304088064)
const PIXELFORMAT_INDEX8 = (UInt32)(318769153)
const PIXELFORMAT_RGB332 = (UInt32)(336660481)
const PIXELFORMAT_RGB444 = (UInt32)(353504258)
const PIXELFORMAT_RGB555 = (UInt32)(353570562)
const PIXELFORMAT_BGR555 = (UInt32)(357764866)
const PIXELFORMAT_ARGB4444 = (UInt32)(355602434)
const PIXELFORMAT_RGBA4444 = (UInt32)(356651010)
const PIXELFORMAT_ABGR4444 = (UInt32)(359796738)
const PIXELFORMAT_BGRA4444 = (UInt32)(360845314)
const PIXELFORMAT_ARGB1555 = (UInt32)(355667970)
const PIXELFORMAT_RGBA5551 = (UInt32)(356782082)
const PIXELFORMAT_ABGR1555 = (UInt32)(359862274)
const PIXELFORMAT_BGRA5551 = (UInt32)(360976386)
const PIXELFORMAT_RGB565 = (UInt32)(353701890)
const PIXELFORMAT_BGR565 = (UInt32)(357896194)
const PIXELFORMAT_RGB24 = (UInt32)(386930691)
const PIXELFORMAT_BGR24 = (UInt32)(390076419)
const PIXELFORMAT_RGB888 = (UInt32)(370546692)
const PIXELFORMAT_RGBX8888 = (UInt32)(371595268)
const PIXELFORMAT_BGR888 = (UInt32)(374740996)
const PIXELFORMAT_BGRX8888 = (UInt32)(375789572)
const PIXELFORMAT_ARGB8888 = (UInt32)(372645892)
const PIXELFORMAT_RGBA8888 = (UInt32)(373694468)
const PIXELFORMAT_ABGR8888 = (UInt32)(376840196)
const PIXELFORMAT_BGRA8888 = (UInt32)(377888772)
const PIXELFORMAT_ARGB2101010 = (UInt32)(372711428)
const PIXELFORMAT_RGBA32 = (UInt32)(376840196)
const PIXELFORMAT_ARGB32 = (UInt32)(377888772)
const PIXELFORMAT_BGRA32 = (UInt32)(372645892)
const PIXELFORMAT_ABGR32 = (UInt32)(373694468)
const PIXELFORMAT_YV12 = (UInt32)(842094169)
const PIXELFORMAT_IYUV = (UInt32)(1448433993)
const PIXELFORMAT_YUY2 = (UInt32)(844715353)
const PIXELFORMAT_UYVY = (UInt32)(1498831189)
const PIXELFORMAT_YVYU = (UInt32)(1431918169)
const PIXELFORMAT_NV12 = (UInt32)(842094158)
const PIXELFORMAT_NV21 = (UInt32)(825382478)
# end enum ANONYMOUS_12

mutable struct Palette
    ncolors::Cint
    colors::Ptr{Color}
    version::Uint32
    refcount::Cint
end

mutable struct PixelFormat
    format::Uint32
    palette::Ptr{Palette}
    BitsPerPixel::Uint8
    BytesPerPixel::Uint8
    padding::NTuple{2, Uint8}
    Rmask::Uint32
    Gmask::Uint32
    Bmask::Uint32
    Amask::Uint32
    Rloss::Uint8
    Gloss::Uint8
    Bloss::Uint8
    Aloss::Uint8
    Rshift::Uint8
    Gshift::Uint8
    Bshift::Uint8
    Ashift::Uint8
    refcount::Cint
    next::Ptr{Cvoid}
end

mutable struct Point
    x::Cint
    y::Cint
end

mutable struct Rect
    x::Cint
    y::Cint
    w::Cint
    h::Cint
end

# begin enum ANONYMOUS_13
const ANONYMOUS_13 = UInt32
const BLENDMODE_NONE = (UInt32)(0)
const BLENDMODE_BLEND = (UInt32)(1)
const BLENDMODE_ADD = (UInt32)(2)
const BLENDMODE_MOD = (UInt32)(4)
# end enum ANONYMOUS_13

const BlendMode = UInt32

mutable struct Surface
    flags::Uint32
    format::Ptr{PixelFormat}
    w::Cint
    h::Cint
    pitch::Cint
    pixels::Ptr{Cvoid}
    userdata::Ptr{Cvoid}
    locked::Cint
    lock_data::Ptr{Cvoid}
    clip_rect::Rect
    map::Ptr{Cvoid}
    refcount::Cint
end

MUSTLOCK(S::Ptr{Surface}) = ((unsafe_load(S).flags & RLEACCEL) != 0)
LoadBMP(file) = LoadBMP_RW(RWFromFile(file, "rb"), Int32(1))
SaveBMP(surface::Ptr{Surface}, file) = SaveBMP_RW(surface, RWFromFile(file, "wb" ), Int32(1))

const blit = Ptr{Cvoid}
mutable struct DisplayMode
    format::Uint32        # pixel format
    w::Cint               # width, in screen coordinates
    h::Cint               # height, in screen coordinates
    refresh_rate::Cint    # refresh rate (or zero for unspecified)
    driverdata::Ptr{Cvoid} # driver-specific data, initialize to 0
end

mutable struct Window
end

# begin enum ANONYMOUS_14
const ANONYMOUS_14 = UInt32
const WINDOW_FULLSCREEN = (UInt32)(1)
const WINDOW_OPENGL = (UInt32)(2)
const WINDOW_SHOWN = (UInt32)(4)
const WINDOW_HIDDEN = (UInt32)(8)
const WINDOW_BORDERLESS = (UInt32)(16)
const WINDOW_RESIZABLE = (UInt32)(32)
const WINDOW_MINIMIZED = (UInt32)(64)
const WINDOW_MAXIMIZED = (UInt32)(128)
const WINDOW_INPUT_GRABBED = (UInt32)(256)
const WINDOW_INPUT_FOCUS = (UInt32)(512)
const WINDOW_MOUSE_FOCUS = (UInt32)(1024)
const WINDOW_FULLSCREEN_DESKTOP = (UInt32)(4097)
const WINDOW_FOREIGN = (UInt32)(2048)
const WINDOW_ALLOW_HIGHDPI = (UInt32)(8192)
const WINDOW_MOUSE_CAPTURE = (UInt32)(16384)
const WINDOW_ALWAYS_ON_TOP = (UInt32)(32768)
const WINDOW_SKIP_TASKBAR = (UInt32)(65536)
const WINDOW_UTILITY = (UInt32)(131072)
const WINDOW_TOOLTIP = (UInt32)(262144)
const WINDOW_POPUP_MENU = (UInt32)(524288)
# end enum ANONYMOUS_14

const WindowFlags = UInt32

# begin enum ANONYMOUS_15
const ANONYMOUS_15 = UInt32
const WINDOWEVENT_NONE = (UInt32)(0)
const WINDOWEVENT_SHOWN = (UInt32)(1)
const WINDOWEVENT_HIDDEN = (UInt32)(2)
const WINDOWEVENT_EXPOSED = (UInt32)(3)
const WINDOWEVENT_MOVED = (UInt32)(4)
const WINDOWEVENT_RESIZED = (UInt32)(5)
const WINDOWEVENT_SIZE_CHANGED = (UInt32)(6)
const WINDOWEVENT_MINIMIZED = (UInt32)(7)
const WINDOWEVENT_MAXIMIZED = (UInt32)(8)
const WINDOWEVENT_RESTORED = (UInt32)(9)
const WINDOWEVENT_ENTER = (UInt32)(10)
const WINDOWEVENT_LEAVE = (UInt32)(11)
const WINDOWEVENT_FOCUS_GAINED = (UInt32)(12)
const WINDOWEVENT_FOCUS_LOST = (UInt32)(13)
const WINDOWEVENT_CLOSE = (UInt32)(14)
const WINDOWEVENT_TAKE_FOCUS = (UInt32)(15)
const WINDOWEVENT_HIT_TEST = (UInt32)(16)
# end enum ANONYMOUS_15

const WindowEventID = UInt32
const GLContext = Ptr{Cvoid}

# begin enum ANONYMOUS_16
const ANONYMOUS_16 = UInt32
const GL_RED_SIZE = (UInt32)(0)
const GL_GREEN_SIZE = (UInt32)(1)
const GL_BLUE_SIZE = (UInt32)(2)
const GL_ALPHA_SIZE = (UInt32)(3)
const GL_BUFFER_SIZE = (UInt32)(4)
const GL_DOUBLEBUFFER = (UInt32)(5)
const GL_DEPTH_SIZE = (UInt32)(6)
const GL_STENCIL_SIZE = (UInt32)(7)
const GL_ACCUM_RED_SIZE = (UInt32)(8)
const GL_ACCUM_GREEN_SIZE = (UInt32)(9)
const GL_ACCUM_BLUE_SIZE = (UInt32)(10)
const GL_ACCUM_ALPHA_SIZE = (UInt32)(11)
const GL_STEREO = (UInt32)(12)
const GL_MULTISAMPLEBUFFERS = (UInt32)(13)
const GL_MULTISAMPLESAMPLES = (UInt32)(14)
const GL_ACCELERATED_VISUAL = (UInt32)(15)
const GL_RETAINED_BACKING = (UInt32)(16)
const GL_CONTEXT_MAJOR_VERSION = (UInt32)(17)
const GL_CONTEXT_MINOR_VERSION = (UInt32)(18)
const GL_CONTEXT_EGL = (UInt32)(19)
const GL_CONTEXT_FLAGS = (UInt32)(20)
const GL_CONTEXT_PROFILE_MASK = (UInt32)(21)
const GL_SHARE_WITH_CURRENT_CONTEXT = (UInt32)(22)
const GL_FRAMEBUFFER_SRGB_CAPABLE = (UInt32)(23)
const GL_CONTEXT_RELEASE_BEHAVIOR = (UInt32)(24)
# end enum ANONYMOUS_16

const GLattr = UInt32

# begin enum ANONYMOUS_17
const ANONYMOUS_17 = UInt32
const GL_CONTEXT_PROFILE_CORE = (UInt32)(1)
const GL_CONTEXT_PROFILE_COMPATIBILITY = (UInt32)(2)
const GL_CONTEXT_PROFILE_ES = (UInt32)(4)
# end enum ANONYMOUS_17

const GLprofile = UInt32

# begin enum ANONYMOUS_18
const ANONYMOUS_18 = UInt32
const GL_CONTEXT_DEBUG_FLAG = (UInt32)(1)
const GL_CONTEXT_FORWARD_COMPATIBLE_FLAG = (UInt32)(2)
const GL_CONTEXT_ROBUST_ACCESS_FLAG = (UInt32)(4)
const GL_CONTEXT_RESET_ISOLATION_FLAG = (UInt32)(8)
# end enum ANONYMOUS_18

const GLcontextFlag = UInt32

# begin enum ANONYMOUS_19
const ANONYMOUS_19 = UInt32
const GL_CONTEXT_RELEASE_BEHAVIOR_NONE = (UInt32)(0)
const GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH = (UInt32)(1)
# end enum ANONYMOUS_19

const GLcontextReleaseFlag = UInt32

# begin enum ANONYMOUS_20
const ANONYMOUS_20 = UInt32
const HITTEST_NORMAL = (UInt32)(0)
const HITTEST_DRAGGABLE = (UInt32)(1)
const HITTEST_RESIZE_TOPLEFT = (UInt32)(2)
const HITTEST_RESIZE_TOP = (UInt32)(3)
const HITTEST_RESIZE_TOPRIGHT = (UInt32)(4)
const HITTEST_RESIZE_RIGHT = (UInt32)(5)
const HITTEST_RESIZE_BOTTOMRIGHT = (UInt32)(6)
const HITTEST_RESIZE_BOTTOM = (UInt32)(7)
const HITTEST_RESIZE_BOTTOMLEFT = (UInt32)(8)
const HITTEST_RESIZE_LEFT = (UInt32)(9)
# end enum ANONYMOUS_20

const HitTestResult = UInt32
const HitTest = Ptr{Cvoid}  # This should be a function pointer.

# begin enum ANONYMOUS_21
const ANONYMOUS_21 = UInt32
const SCANCODE_UNKNOWN = (UInt32)(0)
const SCANCODE_A = (UInt32)(4)
const SCANCODE_B = (UInt32)(5)
const SCANCODE_C = (UInt32)(6)
const SCANCODE_D = (UInt32)(7)
const SCANCODE_E = (UInt32)(8)
const SCANCODE_F = (UInt32)(9)
const SCANCODE_G = (UInt32)(10)
const SCANCODE_H = (UInt32)(11)
const SCANCODE_I = (UInt32)(12)
const SCANCODE_J = (UInt32)(13)
const SCANCODE_K = (UInt32)(14)
const SCANCODE_L = (UInt32)(15)
const SCANCODE_M = (UInt32)(16)
const SCANCODE_N = (UInt32)(17)
const SCANCODE_O = (UInt32)(18)
const SCANCODE_P = (UInt32)(19)
const SCANCODE_Q = (UInt32)(20)
const SCANCODE_R = (UInt32)(21)
const SCANCODE_S = (UInt32)(22)
const SCANCODE_T = (UInt32)(23)
const SCANCODE_U = (UInt32)(24)
const SCANCODE_V = (UInt32)(25)
const SCANCODE_W = (UInt32)(26)
const SCANCODE_X = (UInt32)(27)
const SCANCODE_Y = (UInt32)(28)
const SCANCODE_Z = (UInt32)(29)
const SCANCODE_1 = (UInt32)(30)
const SCANCODE_2 = (UInt32)(31)
const SCANCODE_3 = (UInt32)(32)
const SCANCODE_4 = (UInt32)(33)
const SCANCODE_5 = (UInt32)(34)
const SCANCODE_6 = (UInt32)(35)
const SCANCODE_7 = (UInt32)(36)
const SCANCODE_8 = (UInt32)(37)
const SCANCODE_9 = (UInt32)(38)
const SCANCODE_0 = (UInt32)(39)
const SCANCODE_RETURN = (UInt32)(40)
const SCANCODE_ESCAPE = (UInt32)(41)
const SCANCODE_BACKSPACE = (UInt32)(42)
const SCANCODE_TAB = (UInt32)(43)
const SCANCODE_SPACE = (UInt32)(44)
const SCANCODE_MINUS = (UInt32)(45)
const SCANCODE_EQUALS = (UInt32)(46)
const SCANCODE_LEFTBRACKET = (UInt32)(47)
const SCANCODE_RIGHTBRACKET = (UInt32)(48)
const SCANCODE_BACKSLASH = (UInt32)(49)
const SCANCODE_NONUSHASH = (UInt32)(50)
const SCANCODE_SEMICOLON = (UInt32)(51)
const SCANCODE_APOSTROPHE = (UInt32)(52)
const SCANCODE_GRAVE = (UInt32)(53)
const SCANCODE_COMMA = (UInt32)(54)
const SCANCODE_PERIOD = (UInt32)(55)
const SCANCODE_SLASH = (UInt32)(56)
const SCANCODE_CAPSLOCK = (UInt32)(57)
const SCANCODE_F1 = (UInt32)(58)
const SCANCODE_F2 = (UInt32)(59)
const SCANCODE_F3 = (UInt32)(60)
const SCANCODE_F4 = (UInt32)(61)
const SCANCODE_F5 = (UInt32)(62)
const SCANCODE_F6 = (UInt32)(63)
const SCANCODE_F7 = (UInt32)(64)
const SCANCODE_F8 = (UInt32)(65)
const SCANCODE_F9 = (UInt32)(66)
const SCANCODE_F10 = (UInt32)(67)
const SCANCODE_F11 = (UInt32)(68)
const SCANCODE_F12 = (UInt32)(69)
const SCANCODE_PRINTSCREEN = (UInt32)(70)
const SCANCODE_SCROLLLOCK = (UInt32)(71)
const SCANCODE_PAUSE = (UInt32)(72)
const SCANCODE_INSERT = (UInt32)(73)
const SCANCODE_HOME = (UInt32)(74)
const SCANCODE_PAGEUP = (UInt32)(75)
const SCANCODE_DELETE = (UInt32)(76)
const SCANCODE_END = (UInt32)(77)
const SCANCODE_PAGEDOWN = (UInt32)(78)
const SCANCODE_RIGHT = (UInt32)(79)
const SCANCODE_LEFT = (UInt32)(80)
const SCANCODE_DOWN = (UInt32)(81)
const SCANCODE_UP = (UInt32)(82)
const SCANCODE_NUMLOCKCLEAR = (UInt32)(83)
const SCANCODE_KP_DIVIDE = (UInt32)(84)
const SCANCODE_KP_MULTIPLY = (UInt32)(85)
const SCANCODE_KP_MINUS = (UInt32)(86)
const SCANCODE_KP_PLUS = (UInt32)(87)
const SCANCODE_KP_ENTER = (UInt32)(88)
const SCANCODE_KP_1 = (UInt32)(89)
const SCANCODE_KP_2 = (UInt32)(90)
const SCANCODE_KP_3 = (UInt32)(91)
const SCANCODE_KP_4 = (UInt32)(92)
const SCANCODE_KP_5 = (UInt32)(93)
const SCANCODE_KP_6 = (UInt32)(94)
const SCANCODE_KP_7 = (UInt32)(95)
const SCANCODE_KP_8 = (UInt32)(96)
const SCANCODE_KP_9 = (UInt32)(97)
const SCANCODE_KP_0 = (UInt32)(98)
const SCANCODE_KP_PERIOD = (UInt32)(99)
const SCANCODE_NONUSBACKSLASH = (UInt32)(100)
const SCANCODE_APPLICATION = (UInt32)(101)
const SCANCODE_POWER = (UInt32)(102)
const SCANCODE_KP_EQUALS = (UInt32)(103)
const SCANCODE_F13 = (UInt32)(104)
const SCANCODE_F14 = (UInt32)(105)
const SCANCODE_F15 = (UInt32)(106)
const SCANCODE_F16 = (UInt32)(107)
const SCANCODE_F17 = (UInt32)(108)
const SCANCODE_F18 = (UInt32)(109)
const SCANCODE_F19 = (UInt32)(110)
const SCANCODE_F20 = (UInt32)(111)
const SCANCODE_F21 = (UInt32)(112)
const SCANCODE_F22 = (UInt32)(113)
const SCANCODE_F23 = (UInt32)(114)
const SCANCODE_F24 = (UInt32)(115)
const SCANCODE_EXECUTE = (UInt32)(116)
const SCANCODE_HELP = (UInt32)(117)
const SCANCODE_MENU = (UInt32)(118)
const SCANCODE_SELECT = (UInt32)(119)
const SCANCODE_STOP = (UInt32)(120)
const SCANCODE_AGAIN = (UInt32)(121)
const SCANCODE_UNDO = (UInt32)(122)
const SCANCODE_CUT = (UInt32)(123)
const SCANCODE_COPY = (UInt32)(124)
const SCANCODE_PASTE = (UInt32)(125)
const SCANCODE_FIND = (UInt32)(126)
const SCANCODE_MUTE = (UInt32)(127)
const SCANCODE_VOLUMEUP = (UInt32)(128)
const SCANCODE_VOLUMEDOWN = (UInt32)(129)
const SCANCODE_KP_COMMA = (UInt32)(133)
const SCANCODE_KP_EQUALSAS400 = (UInt32)(134)
const SCANCODE_INTERNATIONAL1 = (UInt32)(135)
const SCANCODE_INTERNATIONAL2 = (UInt32)(136)
const SCANCODE_INTERNATIONAL3 = (UInt32)(137)
const SCANCODE_INTERNATIONAL4 = (UInt32)(138)
const SCANCODE_INTERNATIONAL5 = (UInt32)(139)
const SCANCODE_INTERNATIONAL6 = (UInt32)(140)
const SCANCODE_INTERNATIONAL7 = (UInt32)(141)
const SCANCODE_INTERNATIONAL8 = (UInt32)(142)
const SCANCODE_INTERNATIONAL9 = (UInt32)(143)
const SCANCODE_LANG1 = (UInt32)(144)
const SCANCODE_LANG2 = (UInt32)(145)
const SCANCODE_LANG3 = (UInt32)(146)
const SCANCODE_LANG4 = (UInt32)(147)
const SCANCODE_LANG5 = (UInt32)(148)
const SCANCODE_LANG6 = (UInt32)(149)
const SCANCODE_LANG7 = (UInt32)(150)
const SCANCODE_LANG8 = (UInt32)(151)
const SCANCODE_LANG9 = (UInt32)(152)
const SCANCODE_ALTERASE = (UInt32)(153)
const SCANCODE_SYSREQ = (UInt32)(154)
const SCANCODE_CANCEL = (UInt32)(155)
const SCANCODE_CLEAR = (UInt32)(156)
const SCANCODE_PRIOR = (UInt32)(157)
const SCANCODE_RETURN2 = (UInt32)(158)
const SCANCODE_SEPARATOR = (UInt32)(159)
const SCANCODE_OUT = (UInt32)(160)
const SCANCODE_OPER = (UInt32)(161)
const SCANCODE_CLEARAGAIN = (UInt32)(162)
const SCANCODE_CRSEL = (UInt32)(163)
const SCANCODE_EXSEL = (UInt32)(164)
const SCANCODE_KP_00 = (UInt32)(176)
const SCANCODE_KP_000 = (UInt32)(177)
const SCANCODE_THOUSANDSSEPARATOR = (UInt32)(178)
const SCANCODE_DECIMALSEPARATOR = (UInt32)(179)
const SCANCODE_CURRENCYUNIT = (UInt32)(180)
const SCANCODE_CURRENCYSUBUNIT = (UInt32)(181)
const SCANCODE_KP_LEFTPAREN = (UInt32)(182)
const SCANCODE_KP_RIGHTPAREN = (UInt32)(183)
const SCANCODE_KP_LEFTBRACE = (UInt32)(184)
const SCANCODE_KP_RIGHTBRACE = (UInt32)(185)
const SCANCODE_KP_TAB = (UInt32)(186)
const SCANCODE_KP_BACKSPACE = (UInt32)(187)
const SCANCODE_KP_A = (UInt32)(188)
const SCANCODE_KP_B = (UInt32)(189)
const SCANCODE_KP_C = (UInt32)(190)
const SCANCODE_KP_D = (UInt32)(191)
const SCANCODE_KP_E = (UInt32)(192)
const SCANCODE_KP_F = (UInt32)(193)
const SCANCODE_KP_XOR = (UInt32)(194)
const SCANCODE_KP_POWER = (UInt32)(195)
const SCANCODE_KP_PERCENT = (UInt32)(196)
const SCANCODE_KP_LESS = (UInt32)(197)
const SCANCODE_KP_GREATER = (UInt32)(198)
const SCANCODE_KP_AMPERSAND = (UInt32)(199)
const SCANCODE_KP_DBLAMPERSAND = (UInt32)(200)
const SCANCODE_KP_VERTICALBAR = (UInt32)(201)
const SCANCODE_KP_DBLVERTICALBAR = (UInt32)(202)
const SCANCODE_KP_COLON = (UInt32)(203)
const SCANCODE_KP_HASH = (UInt32)(204)
const SCANCODE_KP_SPACE = (UInt32)(205)
const SCANCODE_KP_AT = (UInt32)(206)
const SCANCODE_KP_EXCLAM = (UInt32)(207)
const SCANCODE_KP_MEMSTORE = (UInt32)(208)
const SCANCODE_KP_MEMRECALL = (UInt32)(209)
const SCANCODE_KP_MEMCLEAR = (UInt32)(210)
const SCANCODE_KP_MEMADD = (UInt32)(211)
const SCANCODE_KP_MEMSUBTRACT = (UInt32)(212)
const SCANCODE_KP_MEMMULTIPLY = (UInt32)(213)
const SCANCODE_KP_MEMDIVIDE = (UInt32)(214)
const SCANCODE_KP_PLUSMINUS = (UInt32)(215)
const SCANCODE_KP_CLEAR = (UInt32)(216)
const SCANCODE_KP_CLEARENTRY = (UInt32)(217)
const SCANCODE_KP_BINARY = (UInt32)(218)
const SCANCODE_KP_OCTAL = (UInt32)(219)
const SCANCODE_KP_DECIMAL = (UInt32)(220)
const SCANCODE_KP_HEXADECIMAL = (UInt32)(221)
const SCANCODE_LCTRL = (UInt32)(224)
const SCANCODE_LSHIFT = (UInt32)(225)
const SCANCODE_LALT = (UInt32)(226)
const SCANCODE_LGUI = (UInt32)(227)
const SCANCODE_RCTRL = (UInt32)(228)
const SCANCODE_RSHIFT = (UInt32)(229)
const SCANCODE_RALT = (UInt32)(230)
const SCANCODE_RGUI = (UInt32)(231)
const SCANCODE_MODE = (UInt32)(257)
const SCANCODE_AUDIONEXT = (UInt32)(258)
const SCANCODE_AUDIOPREV = (UInt32)(259)
const SCANCODE_AUDIOSTOP = (UInt32)(260)
const SCANCODE_AUDIOPLAY = (UInt32)(261)
const SCANCODE_AUDIOMUTE = (UInt32)(262)
const SCANCODE_MEDIASELECT = (UInt32)(263)
const SCANCODE_WWW = (UInt32)(264)
const SCANCODE_MAIL = (UInt32)(265)
const SCANCODE_CALCULATOR = (UInt32)(266)
const SCANCODE_COMPUTER = (UInt32)(267)
const SCANCODE_AC_SEARCH = (UInt32)(268)
const SCANCODE_AC_HOME = (UInt32)(269)
const SCANCODE_AC_BACK = (UInt32)(270)
const SCANCODE_AC_FORWARD = (UInt32)(271)
const SCANCODE_AC_STOP = (UInt32)(272)
const SCANCODE_AC_REFRESH = (UInt32)(273)
const SCANCODE_AC_BOOKMARKS = (UInt32)(274)
const SCANCODE_BRIGHTNESSDOWN = (UInt32)(275)
const SCANCODE_BRIGHTNESSUP = (UInt32)(276)
const SCANCODE_DISPLAYSWITCH = (UInt32)(277)
const SCANCODE_KBDILLUMTOGGLE = (UInt32)(278)
const SCANCODE_KBDILLUMDOWN = (UInt32)(279)
const SCANCODE_KBDILLUMUP = (UInt32)(280)
const SCANCODE_EJECT = (UInt32)(281)
const SCANCODE_SLEEP = (UInt32)(282)
const SCANCODE_APP1 = (UInt32)(283)
const SCANCODE_APP2 = (UInt32)(284)
const NUM_SCANCODES = (UInt32)(512)
# end enum ANONYMOUS_21

const Scancode = Sint32
const Keycode = Sint32

# begin enum ANONYMOUS_22
const ANONYMOUS_22 = UInt32
const SDLK_UNKNOWN = (UInt32)(0)
const SDLK_RETURN = (UInt32)(13)
const SDLK_ESCAPE = (UInt32)(27)
const SDLK_BACKSPACE = (UInt32)(8)
const SDLK_TAB = (UInt32)(9)
const SDLK_SPACE = (UInt32)(32)
const SDLK_EXCLAIM = (UInt32)(33)
const SDLK_QUOTEDBL = (UInt32)(34)
const SDLK_HASH = (UInt32)(35)
const SDLK_PERCENT = (UInt32)(37)
const SDLK_DOLLAR = (UInt32)(36)
const SDLK_AMPERSAND = (UInt32)(38)
const SDLK_QUOTE = (UInt32)(39)
const SDLK_LEFTPAREN = (UInt32)(40)
const SDLK_RIGHTPAREN = (UInt32)(41)
const SDLK_ASTERISK = (UInt32)(42)
const SDLK_PLUS = (UInt32)(43)
const SDLK_COMMA = (UInt32)(44)
const SDLK_MINUS = (UInt32)(45)
const SDLK_PERIOD = (UInt32)(46)
const SDLK_SLASH = (UInt32)(47)
const SDLK_0 = (UInt32)(48)
const SDLK_1 = (UInt32)(49)
const SDLK_2 = (UInt32)(50)
const SDLK_3 = (UInt32)(51)
const SDLK_4 = (UInt32)(52)
const SDLK_5 = (UInt32)(53)
const SDLK_6 = (UInt32)(54)
const SDLK_7 = (UInt32)(55)
const SDLK_8 = (UInt32)(56)
const SDLK_9 = (UInt32)(57)
const SDLK_COLON = (UInt32)(58)
const SDLK_SEMICOLON = (UInt32)(59)
const SDLK_LESS = (UInt32)(60)
const SDLK_EQUALS = (UInt32)(61)
const SDLK_GREATER = (UInt32)(62)
const SDLK_QUESTION = (UInt32)(63)
const SDLK_AT = (UInt32)(64)
const SDLK_LEFTBRACKET = (UInt32)(91)
const SDLK_BACKSLASH = (UInt32)(92)
const SDLK_RIGHTBRACKET = (UInt32)(93)
const SDLK_CARET = (UInt32)(94)
const SDLK_UNDERSCORE = (UInt32)(95)
const SDLK_BACKQUOTE = (UInt32)(96)
const SDLK_a = (UInt32)(97)
const SDLK_b = (UInt32)(98)
const SDLK_c = (UInt32)(99)
const SDLK_d = (UInt32)(100)
const SDLK_e = (UInt32)(101)
const SDLK_f = (UInt32)(102)
const SDLK_g = (UInt32)(103)
const SDLK_h = (UInt32)(104)
const SDLK_i = (UInt32)(105)
const SDLK_j = (UInt32)(106)
const SDLK_k = (UInt32)(107)
const SDLK_l = (UInt32)(108)
const SDLK_m = (UInt32)(109)
const SDLK_n = (UInt32)(110)
const SDLK_o = (UInt32)(111)
const SDLK_p = (UInt32)(112)
const SDLK_q = (UInt32)(113)
const SDLK_r = (UInt32)(114)
const SDLK_s = (UInt32)(115)
const SDLK_t = (UInt32)(116)
const SDLK_u = (UInt32)(117)
const SDLK_v = (UInt32)(118)
const SDLK_w = (UInt32)(119)
const SDLK_x = (UInt32)(120)
const SDLK_y = (UInt32)(121)
const SDLK_z = (UInt32)(122)
const SDLK_CAPSLOCK = (UInt32)(1073741881)
const SDLK_F1 = (UInt32)(1073741882)
const SDLK_F2 = (UInt32)(1073741883)
const SDLK_F3 = (UInt32)(1073741884)
const SDLK_F4 = (UInt32)(1073741885)
const SDLK_F5 = (UInt32)(1073741886)
const SDLK_F6 = (UInt32)(1073741887)
const SDLK_F7 = (UInt32)(1073741888)
const SDLK_F8 = (UInt32)(1073741889)
const SDLK_F9 = (UInt32)(1073741890)
const SDLK_F10 = (UInt32)(1073741891)
const SDLK_F11 = (UInt32)(1073741892)
const SDLK_F12 = (UInt32)(1073741893)
const SDLK_PRINTSCREEN = (UInt32)(1073741894)
const SDLK_SCROLLLOCK = (UInt32)(1073741895)
const SDLK_PAUSE = (UInt32)(1073741896)
const SDLK_INSERT = (UInt32)(1073741897)
const SDLK_HOME = (UInt32)(1073741898)
const SDLK_PAGEUP = (UInt32)(1073741899)
const SDLK_DELETE = (UInt32)(127)
const SDLK_END = (UInt32)(1073741901)
const SDLK_PAGEDOWN = (UInt32)(1073741902)
const SDLK_RIGHT = (UInt32)(1073741903)
const SDLK_LEFT = (UInt32)(1073741904)
const SDLK_DOWN = (UInt32)(1073741905)
const SDLK_UP = (UInt32)(1073741906)
const SDLK_NUMLOCKCLEAR = (UInt32)(1073741907)
const SDLK_KP_DIVIDE = (UInt32)(1073741908)
const SDLK_KP_MULTIPLY = (UInt32)(1073741909)
const SDLK_KP_MINUS = (UInt32)(1073741910)
const SDLK_KP_PLUS = (UInt32)(1073741911)
const SDLK_KP_ENTER = (UInt32)(1073741912)
const SDLK_KP_1 = (UInt32)(1073741913)
const SDLK_KP_2 = (UInt32)(1073741914)
const SDLK_KP_3 = (UInt32)(1073741915)
const SDLK_KP_4 = (UInt32)(1073741916)
const SDLK_KP_5 = (UInt32)(1073741917)
const SDLK_KP_6 = (UInt32)(1073741918)
const SDLK_KP_7 = (UInt32)(1073741919)
const SDLK_KP_8 = (UInt32)(1073741920)
const SDLK_KP_9 = (UInt32)(1073741921)
const SDLK_KP_0 = (UInt32)(1073741922)
const SDLK_KP_PERIOD = (UInt32)(1073741923)
const SDLK_APPLICATION = (UInt32)(1073741925)
const SDLK_POWER = (UInt32)(1073741926)
const SDLK_KP_EQUALS = (UInt32)(1073741927)
const SDLK_F13 = (UInt32)(1073741928)
const SDLK_F14 = (UInt32)(1073741929)
const SDLK_F15 = (UInt32)(1073741930)
const SDLK_F16 = (UInt32)(1073741931)
const SDLK_F17 = (UInt32)(1073741932)
const SDLK_F18 = (UInt32)(1073741933)
const SDLK_F19 = (UInt32)(1073741934)
const SDLK_F20 = (UInt32)(1073741935)
const SDLK_F21 = (UInt32)(1073741936)
const SDLK_F22 = (UInt32)(1073741937)
const SDLK_F23 = (UInt32)(1073741938)
const SDLK_F24 = (UInt32)(1073741939)
const SDLK_EXECUTE = (UInt32)(1073741940)
const SDLK_HELP = (UInt32)(1073741941)
const SDLK_MENU = (UInt32)(1073741942)
const SDLK_SELECT = (UInt32)(1073741943)
const SDLK_STOP = (UInt32)(1073741944)
const SDLK_AGAIN = (UInt32)(1073741945)
const SDLK_UNDO = (UInt32)(1073741946)
const SDLK_CUT = (UInt32)(1073741947)
const SDLK_COPY = (UInt32)(1073741948)
const SDLK_PASTE = (UInt32)(1073741949)
const SDLK_FIND = (UInt32)(1073741950)
const SDLK_MUTE = (UInt32)(1073741951)
const SDLK_VOLUMEUP = (UInt32)(1073741952)
const SDLK_VOLUMEDOWN = (UInt32)(1073741953)
const SDLK_KP_COMMA = (UInt32)(1073741957)
const SDLK_KP_EQUALSAS400 = (UInt32)(1073741958)
const SDLK_ALTERASE = (UInt32)(1073741977)
const SDLK_SYSREQ = (UInt32)(1073741978)
const SDLK_CANCEL = (UInt32)(1073741979)
const SDLK_CLEAR = (UInt32)(1073741980)
const SDLK_PRIOR = (UInt32)(1073741981)
const SDLK_RETURN2 = (UInt32)(1073741982)
const SDLK_SEPARATOR = (UInt32)(1073741983)
const SDLK_OUT = (UInt32)(1073741984)
const SDLK_OPER = (UInt32)(1073741985)
const SDLK_CLEARAGAIN = (UInt32)(1073741986)
const SDLK_CRSEL = (UInt32)(1073741987)
const SDLK_EXSEL = (UInt32)(1073741988)
const SDLK_KP_00 = (UInt32)(1073742000)
const SDLK_KP_000 = (UInt32)(1073742001)
const SDLK_THOUSANDSSEPARATOR = (UInt32)(1073742002)
const SDLK_DECIMALSEPARATOR = (UInt32)(1073742003)
const SDLK_CURRENCYUNIT = (UInt32)(1073742004)
const SDLK_CURRENCYSUBUNIT = (UInt32)(1073742005)
const SDLK_KP_LEFTPAREN = (UInt32)(1073742006)
const SDLK_KP_RIGHTPAREN = (UInt32)(1073742007)
const SDLK_KP_LEFTBRACE = (UInt32)(1073742008)
const SDLK_KP_RIGHTBRACE = (UInt32)(1073742009)
const SDLK_KP_TAB = (UInt32)(1073742010)
const SDLK_KP_BACKSPACE = (UInt32)(1073742011)
const SDLK_KP_A = (UInt32)(1073742012)
const SDLK_KP_B = (UInt32)(1073742013)
const SDLK_KP_C = (UInt32)(1073742014)
const SDLK_KP_D = (UInt32)(1073742015)
const SDLK_KP_E = (UInt32)(1073742016)
const SDLK_KP_F = (UInt32)(1073742017)
const SDLK_KP_XOR = (UInt32)(1073742018)
const SDLK_KP_POWER = (UInt32)(1073742019)
const SDLK_KP_PERCENT = (UInt32)(1073742020)
const SDLK_KP_LESS = (UInt32)(1073742021)
const SDLK_KP_GREATER = (UInt32)(1073742022)
const SDLK_KP_AMPERSAND = (UInt32)(1073742023)
const SDLK_KP_DBLAMPERSAND = (UInt32)(1073742024)
const SDLK_KP_VERTICALBAR = (UInt32)(1073742025)
const SDLK_KP_DBLVERTICALBAR = (UInt32)(1073742026)
const SDLK_KP_COLON = (UInt32)(1073742027)
const SDLK_KP_HASH = (UInt32)(1073742028)
const SDLK_KP_SPACE = (UInt32)(1073742029)
const SDLK_KP_AT = (UInt32)(1073742030)
const SDLK_KP_EXCLAM = (UInt32)(1073742031)
const SDLK_KP_MEMSTORE = (UInt32)(1073742032)
const SDLK_KP_MEMRECALL = (UInt32)(1073742033)
const SDLK_KP_MEMCLEAR = (UInt32)(1073742034)
const SDLK_KP_MEMADD = (UInt32)(1073742035)
const SDLK_KP_MEMSUBTRACT = (UInt32)(1073742036)
const SDLK_KP_MEMMULTIPLY = (UInt32)(1073742037)
const SDLK_KP_MEMDIVIDE = (UInt32)(1073742038)
const SDLK_KP_PLUSMINUS = (UInt32)(1073742039)
const SDLK_KP_CLEAR = (UInt32)(1073742040)
const SDLK_KP_CLEARENTRY = (UInt32)(1073742041)
const SDLK_KP_BINARY = (UInt32)(1073742042)
const SDLK_KP_OCTAL = (UInt32)(1073742043)
const SDLK_KP_DECIMAL = (UInt32)(1073742044)
const SDLK_KP_HEXADECIMAL = (UInt32)(1073742045)
const SDLK_LCTRL = (UInt32)(1073742048)
const SDLK_LSHIFT = (UInt32)(1073742049)
const SDLK_LALT = (UInt32)(1073742050)
const SDLK_LGUI = (UInt32)(1073742051)
const SDLK_RCTRL = (UInt32)(1073742052)
const SDLK_RSHIFT = (UInt32)(1073742053)
const SDLK_RALT = (UInt32)(1073742054)
const SDLK_RGUI = (UInt32)(1073742055)
const SDLK_MODE = (UInt32)(1073742081)
const SDLK_AUDIONEXT = (UInt32)(1073742082)
const SDLK_AUDIOPREV = (UInt32)(1073742083)
const SDLK_AUDIOSTOP = (UInt32)(1073742084)
const SDLK_AUDIOPLAY = (UInt32)(1073742085)
const SDLK_AUDIOMUTE = (UInt32)(1073742086)
const SDLK_MEDIASELECT = (UInt32)(1073742087)
const SDLK_WWW = (UInt32)(1073742088)
const SDLK_MAIL = (UInt32)(1073742089)
const SDLK_CALCULATOR = (UInt32)(1073742090)
const SDLK_COMPUTER = (UInt32)(1073742091)
const SDLK_AC_SEARCH = (UInt32)(1073742092)
const SDLK_AC_HOME = (UInt32)(1073742093)
const SDLK_AC_BACK = (UInt32)(1073742094)
const SDLK_AC_FORWARD = (UInt32)(1073742095)
const SDLK_AC_STOP = (UInt32)(1073742096)
const SDLK_AC_REFRESH = (UInt32)(1073742097)
const SDLK_AC_BOOKMARKS = (UInt32)(1073742098)
const SDLK_BRIGHTNESSDOWN = (UInt32)(1073742099)
const SDLK_BRIGHTNESSUP = (UInt32)(1073742100)
const SDLK_DISPLAYSWITCH = (UInt32)(1073742101)
const SDLK_KBDILLUMTOGGLE = (UInt32)(1073742102)
const SDLK_KBDILLUMDOWN = (UInt32)(1073742103)
const SDLK_KBDILLUMUP = (UInt32)(1073742104)
const SDLK_EJECT = (UInt32)(1073742105)
const SDLK_SLEEP = (UInt32)(1073742106)
# end enum ANONYMOUS_22

struct Keysym
    scancode::Scancode
    sym::Keycode
    mod::Uint16
    unused::Uint32
end

mutable struct Cursor
end

# begin enum ANONYMOUS_24
const ANONYMOUS_24 = UInt32
const SYSTEM_CURSOR_ARROW = (UInt32)(0)
const SYSTEM_CURSOR_IBEAM = (UInt32)(1)
const SYSTEM_CURSOR_WAIT = (UInt32)(2)
const SYSTEM_CURSOR_CROSSHAIR = (UInt32)(3)
const SYSTEM_CURSOR_WAITARROW = (UInt32)(4)
const SYSTEM_CURSOR_SIZENWSE = (UInt32)(5)
const SYSTEM_CURSOR_SIZENESW = (UInt32)(6)
const SYSTEM_CURSOR_SIZEWE = (UInt32)(7)
const SYSTEM_CURSOR_SIZENS = (UInt32)(8)
const SYSTEM_CURSOR_SIZEALL = (UInt32)(9)
const SYSTEM_CURSOR_NO = (UInt32)(10)
const SYSTEM_CURSOR_HAND = (UInt32)(11)
const NUM_SYSTEM_CURSORS = (UInt32)(12)
# end enum ANONYMOUS_24

const SystemCursor = UInt32

# begin enum ANONYMOUS_25
const ANONYMOUS_25 = UInt32
const MOUSEWHEEL_NORMAL = (UInt32)(0)
const MOUSEWHEEL_FLIPPED = (UInt32)(1)
# end enum ANONYMOUS_25

const MouseWheelDirection = UInt32

mutable struct _Joystick
end
const Joystick = _Joystick

# A structure that encodes the stable unique id for a joystick device
mutable struct JoystickGUID
    data::NTuple{16, Uint8}
end

const JoystickID = Sint32

# begin enum ANONYMOUS_26
const ANONYMOUS_26 = Cint
const JOYSTICK_POWER_UNKNOWN = (Int32)(-1)
const JOYSTICK_POWER_EMPTY = (Int32)(0)
const JOYSTICK_POWER_LOW = (Int32)(1)
const JOYSTICK_POWER_MEDIUM = (Int32)(2)
const JOYSTICK_POWER_FULL = (Int32)(3)
const JOYSTICK_POWER_WIRED = (Int32)(4)
const JOYSTICK_POWER_MAX = (Int32)(5)
# end enum ANONYMOUS_26

const JoystickPowerLevel = Int32

mutable struct _GameController
end

const GameController = _GameController

# begin enum ANONYMOUS_27
const ANONYMOUS_27 = UInt32
const CONTROLLER_BINDTYPE_NONE = (UInt32)(0)
const CONTROLLER_BINDTYPE_BUTTON = (UInt32)(1)
const CONTROLLER_BINDTYPE_AXIS = (UInt32)(2)
const CONTROLLER_BINDTYPE_HAT = (UInt32)(3)
# end enum ANONYMOUS_27

const GameControllerBindType = UInt32

mutable struct GameControllerButtonBind
    bindType::GameControllerBindType
    value::Cvoid
end

# begin enum ANONYMOUS_28
const ANONYMOUS_28 = Cint
const CONTROLLER_AXIS_INVALID = (Int32)(-1)
const CONTROLLER_AXIS_LEFTX = (Int32)(0)
const CONTROLLER_AXIS_LEFTY = (Int32)(1)
const CONTROLLER_AXIS_RIGHTX = (Int32)(2)
const CONTROLLER_AXIS_RIGHTY = (Int32)(3)
const CONTROLLER_AXIS_TRIGGERLEFT = (Int32)(4)
const CONTROLLER_AXIS_TRIGGERRIGHT = (Int32)(5)
const CONTROLLER_AXIS_MAX = (Int32)(6)
# end enum ANONYMOUS_28

const GameControllerAxis = Int32

# begin enum ANONYMOUS_29
const ANONYMOUS_29 = Cint
const CONTROLLER_BUTTON_INVALID = (Int32)(-1)
const CONTROLLER_BUTTON_A = (Int32)(0)
const CONTROLLER_BUTTON_B = (Int32)(1)
const CONTROLLER_BUTTON_X = (Int32)(2)
const CONTROLLER_BUTTON_Y = (Int32)(3)
const CONTROLLER_BUTTON_BACK = (Int32)(4)
const CONTROLLER_BUTTON_GUIDE = (Int32)(5)
const CONTROLLER_BUTTON_START = (Int32)(6)
const CONTROLLER_BUTTON_LEFTSTICK = (Int32)(7)
const CONTROLLER_BUTTON_RIGHTSTICK = (Int32)(8)
const CONTROLLER_BUTTON_LEFTSHOULDER = (Int32)(9)
const CONTROLLER_BUTTON_RIGHTSHOULDER = (Int32)(10)
const CONTROLLER_BUTTON_DPAD_UP = (Int32)(11)
const CONTROLLER_BUTTON_DPAD_DOWN = (Int32)(12)
const CONTROLLER_BUTTON_DPAD_LEFT = (Int32)(13)
const CONTROLLER_BUTTON_DPAD_RIGHT = (Int32)(14)
const CONTROLLER_BUTTON_MAX = (Int32)(15)
# end enum ANONYMOUS_29

const GameControllerButton = Int32
const TouchID = Sint64
const FingerID = Sint64

mutable struct Finger
    id::FingerID
    x::Cfloat
    y::Cfloat
    pressure::Cfloat
end

const GestureID = Sint64

# begin enum ANONYMOUS_30
const ANONYMOUS_30 = UInt32
const FIRSTEVENT = (UInt32)(0)
const QUIT = (UInt32)(256)
const APP_TERMINATING = (UInt32)(257)
const APP_LOWMEMORY = (UInt32)(258)
const APP_WILLENTERBACKGROUND = (UInt32)(259)
const APP_DIDENTERBACKGROUND = (UInt32)(260)
const APP_WILLENTERFOREGROUND = (UInt32)(261)
const APP_DIDENTERFOREGROUND = (UInt32)(262)
const WINDOWEVENT = (UInt32)(512)
const SYSWMEVENT = (UInt32)(513)
const KEYDOWN = (UInt32)(768)
const KEYUP = (UInt32)(769)
const TEXTEDITING = (UInt32)(770)
const TEXTINPUT = (UInt32)(771)
const KEYMAPCHANGED = (UInt32)(772)
const MOUSEMOTION = (UInt32)(1024)
const MOUSEBUTTONDOWN = (UInt32)(1025)
const MOUSEBUTTONUP = (UInt32)(1026)
const MOUSEWHEEL = (UInt32)(1027)
const JOYAXISMOTION = (UInt32)(1536)
const JOYBALLMOTION = (UInt32)(1537)
const JOYHATMOTION = (UInt32)(1538)
const JOYBUTTONDOWN = (UInt32)(1539)
const JOYBUTTONUP = (UInt32)(1540)
const JOYDEVICEADDED = (UInt32)(1541)
const JOYDEVICEREMOVED = (UInt32)(1542)
const CONTROLLERAXISMOTION = (UInt32)(1616)
const CONTROLLERBUTTONDOWN = (UInt32)(1617)
const CONTROLLERBUTTONUP = (UInt32)(1618)
const CONTROLLERDEVICEADDED = (UInt32)(1619)
const CONTROLLERDEVICEREMOVED = (UInt32)(1620)
const CONTROLLERDEVICEREMAPPED = (UInt32)(1621)
const FINGERDOWN = (UInt32)(1792)
const FINGERUP = (UInt32)(1793)
const FINGERMOTION = (UInt32)(1794)
const DOLLARGESTURE = (UInt32)(2048)
const DOLLARRECORD = (UInt32)(2049)
const MULTIGESTURE = (UInt32)(2050)
const CLIPBOARDUPDATE = (UInt32)(2304)
const DROPFILE = (UInt32)(4096)
const DROPTEXT = (UInt32)(4097)
const DROPBEGIN = (UInt32)(4098)
const DROPCOMPLETE = (UInt32)(4099)
const AUDIODEVICEADDED = (UInt32)(4352)
const AUDIODEVICEREMOVED = (UInt32)(4353)
const RENDER_TARGETS_RESET = (UInt32)(8192)
const RENDER_DEVICE_RESET = (UInt32)(8193)
const USEREVENT = (UInt32)(32768)
const LASTEVENT = (UInt32)(65535)
# end enum ANONYMOUS_30

const EventType = UInt32

abstract type AbstractEvent end

mutable struct CommonEvent <: AbstractEvent
    _type::Uint32
    timestamp::Uint32
end

mutable struct WindowEvent <: AbstractEvent
    _type::Uint32
    timestamp::Uint32
    windowID::Uint32
    event::Uint8
    padding1::Uint8
    padding2::Uint8
    padding3::Uint8
    data1::Sint32
    data2::Sint32
end

struct KeyboardEvent <: AbstractEvent
    _type::Uint32
    timestamp::Uint32
    windowID::Uint32
    state::UInt8
    repeat::UInt8
    padding2::UInt8
    padding3::UInt8
    keysym::Keysym
end

mutable struct TextEditingEvent <: AbstractEvent
    _type::Uint32
    timestamp::Uint32
    windowID::Uint32
    text::NTuple{32, UInt8}
    start::Sint32
    length::Sint32
end

mutable struct TextInputEvent <: AbstractEvent
    _type::Uint32
    timestamp::Uint32
    windowID::Uint32
    text::NTuple{32, UInt8}
end

mutable struct MouseMotionEvent <: AbstractEvent
    _type::Uint32
    timestamp::Uint32
    windowID::Uint32
    which::Uint32
    state::Uint32
    x::Sint32
    y::Sint32
    xrel::Sint32
    yrel::Sint32
end

mutable struct MouseButtonEvent <: AbstractEvent
    _type::Uint32
    timestamp::Uint32
    windowID::Uint32
    which::Uint32
    button::Uint8
    state::Uint8
    clicks::Uint8
    padding1::Uint8
    x::Sint32
    y::Sint32
end

mutable struct MouseWheelEvent <: AbstractEvent
    _type::Uint32
    timestamp::Uint32
    windowID::Uint32
    which::Uint32
    x::Sint32
    y::Sint32
    direction::Uint32
end

mutable struct JoyAxisEvent <: AbstractEvent
    _type::Uint32
    timestamp::Uint32
    which::JoystickID
    axis::Uint8
    padding1::Uint8
    padding2::Uint8
    padding3::Uint8
    value::Sint16
    padding4::Uint16
end

mutable struct JoyBallEvent <: AbstractEvent
    _type::Uint32
    timestamp::Uint32
    which::JoystickID
    ball::Uint8
    padding1::Uint8
    padding2::Uint8
    padding3::Uint8
    xrel::Sint16
    yrel::Sint16
end

mutable struct JoyHatEvent <: AbstractEvent
    _type::Uint32
    timestamp::Uint32
    which::JoystickID
    hat::Uint8
    value::Uint8
    padding1::Uint8
    padding2::Uint8
end

mutable struct JoyButtonEvent <: AbstractEvent
    _type::Uint32
    timestamp::Uint32
    which::JoystickID
    button::Uint8
    state::Uint8
    padding1::Uint8
    padding2::Uint8
end

mutable struct JoyDeviceEvent <: AbstractEvent
    _type::Uint32
    timestamp::Uint32
    which::Sint32
end

mutable struct ControllerAxisEvent <: AbstractEvent
    _type::Uint32
    timestamp::Uint32
    which::JoystickID
    axis::Uint8
    padding1::Uint8
    padding2::Uint8
    padding3::Uint8
    value::Sint16
    padding4::Uint16
end

mutable struct ControllerButtonEvent <: AbstractEvent
    _type::Uint32
    timestamp::Uint32
    which::JoystickID
    button::Uint8
    state::Uint8
    padding1::Uint8
    padding2::Uint8
end

mutable struct ControllerDeviceEvent <: AbstractEvent
    _type::Uint32
    timestamp::Uint32
    which::Sint32
end

mutable struct AudioDeviceEvent <: AbstractEvent
    _type::Uint32
    timestamp::Uint32
    which::Uint32
    iscapture::Uint8
    padding1::Uint8
    padding2::Uint8
    padding3::Uint8
end

mutable struct TouchFingerEvent <: AbstractEvent
    _type::Uint32
    timestamp::Uint32
    touchId::TouchID
    fingerId::FingerID
    x::Cfloat
    y::Cfloat
    dx::Cfloat
    dy::Cfloat
    pressure::Cfloat
end

mutable struct MultiGestureEvent <: AbstractEvent
    _type::Uint32
    timestamp::Uint32
    touchId::TouchID
    dTheta::Cfloat
    dDist::Cfloat
    x::Cfloat
    y::Cfloat
    numFingers::Uint16
    padding::Uint16
end

mutable struct DollarGestureEvent <: AbstractEvent
    _type::Uint32
    timestamp::Uint32
    touchId::TouchID
    gestureId::GestureID
    numFingers::Uint32
    error::Cfloat
    x::Cfloat
    y::Cfloat
end

mutable struct DropEvent <: AbstractEvent
    _type::Uint32
    timestamp::Uint32
    file::Cstring
    windowID::Uint32
end

mutable struct QuitEvent <: AbstractEvent
    _type::Uint32
    timestamp::Uint32
end

mutable struct OSEvent <: AbstractEvent
    _type::Uint32
    timestamp::Uint32
end

mutable struct UserEvent <: AbstractEvent
    _type::Uint32
    timestamp::Uint32
    windowID::Uint32
    code::Sint32
    data1::Ptr{Cvoid}
    data2::Ptr{Cvoid}
end

mutable struct SysWMmsg
end

mutable struct SysWMEvent <: AbstractEvent
    _type::Uint32
    timestamp::Uint32
    msg::Ptr{SysWMmsg}
end

mutable struct Event <: AbstractEvent
    _Event::NTuple{56, Uint8}  # SDL_Event is a 56 byte union in C.
end

const event_type_to_event = Dict{EventType,Any}( #FIXME AbstractEvent?
    WINDOWEVENT => WindowEvent,
    KEYDOWN => KeyboardEvent,
    KEYUP => KeyboardEvent,
    TEXTEDITING => TextEditingEvent,
    TEXTINPUT => TextInputEvent,
    MOUSEMOTION => MouseMotionEvent,
    MOUSEBUTTONDOWN => MouseButtonEvent,
    MOUSEBUTTONUP => MouseButtonEvent,
    MOUSEWHEEL => MouseWheelEvent,
    DROPFILE => DropEvent,
    DROPTEXT => DropEvent,
    DROPBEGIN => DropEvent,
    DROPCOMPLETE => DropEvent,
    QUIT => QuitEvent,
    USEREVENT => UserEvent
)

function Event(t::EventType)
    haskey(event_type_to_event,t) && return event_type_to_event[t]
    nothing
end

#const Event = Cvoid

# begin enum ANONYMOUS_31
const ANONYMOUS_31 = UInt32
const ADDEVENT = (UInt32)(0)
const PEEKEVENT = (UInt32)(1)
const GETEVENT = (UInt32)(2)
# end enum ANONYMOUS_31

const Eventaction = UInt32
const EventFilter = Ptr{Cvoid}

mutable struct _Haptic
end

const Haptic = _Haptic

mutable struct HapticDirection
    _type::Uint8
    dir::NTuple{3, Sint32}
end

mutable struct HapticConstant
    _type::Uint16
    direction::HapticDirection
    length::Uint32
    delay::Uint16
    button::Uint16
    interval::Uint16
    level::Sint16
    attack_length::Uint16
    attack_level::Uint16
    fade_length::Uint16
    fade_level::Uint16
end

mutable struct HapticPeriodic
    _type::Uint16
    direction::HapticDirection
    length::Uint32
    delay::Uint16
    button::Uint16
    interval::Uint16
    period::Uint16
    magnitude::Sint16
    offset::Sint16
    phase::Uint16
    attack_length::Uint16
    attack_level::Uint16
    fade_length::Uint16
    fade_level::Uint16
end

mutable struct HapticCondition
    _type::Uint16
    direction::HapticDirection
    length::Uint32
    delay::Uint16
    button::Uint16
    interval::Uint16
    right_sat::NTuple{3, Uint16}
    left_sat::NTuple{3, Uint16}
    right_coeff::NTuple{3, Sint16}
    left_coeff::NTuple{3, Sint16}
    deadband::NTuple{3, Uint16}
    center::NTuple{3, Sint16}
end

mutable struct HapticRamp
    _type::Uint16
    direction::HapticDirection
    length::Uint32
    delay::Uint16
    button::Uint16
    interval::Uint16
    start::Sint16
    _end::Sint16
    attack_length::Uint16
    attack_level::Uint16
    fade_length::Uint16
    fade_level::Uint16
end

mutable struct HapticLeftRight
    _type::Uint16
    length::Uint32
    large_magnitude::Uint16
    small_magnitude::Uint16
end

mutable struct HapticCustom
    _type::Uint16
    direction::HapticDirection
    length::Uint32
    delay::Uint16
    button::Uint16
    interval::Uint16
    channels::Uint8
    period::Uint16
    samples::Uint16
    data::Ptr{Uint16}
    attack_length::Uint16
    attack_level::Uint16
    fade_length::Uint16
    fade_level::Uint16
end

mutable struct HapticEffect
    _HapticEffect::Uint16
end

#const HapticEffect = Cvoid

# begin enum ANONYMOUS_32
const ANONYMOUS_32 = UInt32
const HINT_DEFAULT = (UInt32)(0)
const HINT_NORMAL = (UInt32)(1)
const HINT_OVERRIDE = (UInt32)(2)
# end enum ANONYMOUS_32

const HintPriority = UInt32
const HintCallback = Ptr{Cvoid}

# begin enum ANONYMOUS_33
const ANONYMOUS_33 = UInt32
const LOG_CATEGORY_APPLICATION = (UInt32)(0)
const LOG_CATEGORY_ERROR = (UInt32)(1)
const LOG_CATEGORY_ASSERT = (UInt32)(2)
const LOG_CATEGORY_SYSTEM = (UInt32)(3)
const LOG_CATEGORY_AUDIO = (UInt32)(4)
const LOG_CATEGORY_VIDEO = (UInt32)(5)
const LOG_CATEGORY_RENDER = (UInt32)(6)
const LOG_CATEGORY_INPUT = (UInt32)(7)
const LOG_CATEGORY_TEST = (UInt32)(8)
const LOG_CATEGORY_RESERVED1 = (UInt32)(9)
const LOG_CATEGORY_RESERVED2 = (UInt32)(10)
const LOG_CATEGORY_RESERVED3 = (UInt32)(11)
const LOG_CATEGORY_RESERVED4 = (UInt32)(12)
const LOG_CATEGORY_RESERVED5 = (UInt32)(13)
const LOG_CATEGORY_RESERVED6 = (UInt32)(14)
const LOG_CATEGORY_RESERVED7 = (UInt32)(15)
const LOG_CATEGORY_RESERVED8 = (UInt32)(16)
const LOG_CATEGORY_RESERVED9 = (UInt32)(17)
const LOG_CATEGORY_RESERVED10 = (UInt32)(18)
const LOG_CATEGORY_CUSTOM = (UInt32)(19)
# end enum ANONYMOUS_33

# begin enum ANONYMOUS_34
const ANONYMOUS_34 = UInt32
const LOG_PRIORITY_VERBOSE = (UInt32)(1)
const LOG_PRIORITY_DEBUG = (UInt32)(2)
const LOG_PRIORITY_INFO = (UInt32)(3)
const LOG_PRIORITY_WARN = (UInt32)(4)
const LOG_PRIORITY_ERROR = (UInt32)(5)
const LOG_PRIORITY_CRITICAL = (UInt32)(6)
const NUM_LOG_PRIORITIES = (UInt32)(7)
# end enum ANONYMOUS_34

const LogPriority = UInt32
const LogOutputFunction = Ptr{Cvoid}

# begin enum ANONYMOUS_35
const ANONYMOUS_35 = UInt32
const MESSAGEBOX_ERROR = (UInt32)(16)
const MESSAGEBOX_WARNING = (UInt32)(32)
const MESSAGEBOX_INFORMATION = (UInt32)(64)
# end enum ANONYMOUS_35

const MessageBoxFlags = UInt32

# begin enum ANONYMOUS_36
const ANONYMOUS_36 = UInt32
const MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT = (UInt32)(1)
const MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT = (UInt32)(2)
# end enum ANONYMOUS_36

const MessageBoxButtonFlags = Cvoid
const MessageBoxButtonData = Cvoid
const MessageBoxColor = Cvoid

# begin enum ANONYMOUS_37
const ANONYMOUS_37 = UInt32
const MESSAGEBOX_COLOR_BACKGROUND = (UInt32)(0)
const MESSAGEBOX_COLOR_TEXT = (UInt32)(1)
const MESSAGEBOX_COLOR_BUTTON_BORDER = (UInt32)(2)
const MESSAGEBOX_COLOR_BUTTON_BACKGROUND = (UInt32)(3)
const MESSAGEBOX_COLOR_BUTTON_SELECTED = (UInt32)(4)
const MESSAGEBOX_COLOR_MAX = (UInt32)(5)
# end enum ANONYMOUS_37

const MessageBoxColorType = Cvoid
const MessageBoxColorScheme = Cvoid
const MessageBoxData = Cvoid

# begin enum ANONYMOUS_38
const ANONYMOUS_38 = UInt32
const POWERSTATE_UNKNOWN = (UInt32)(0)
const POWERSTATE_ON_BATTERY = (UInt32)(1)
const POWERSTATE_NO_BATTERY = (UInt32)(2)
const POWERSTATE_CHARGING = (UInt32)(3)
const POWERSTATE_CHARGED = (UInt32)(4)
# end enum ANONYMOUS_38

const PowerState = UInt32

# begin enum ANONYMOUS_39
const ANONYMOUS_39 = UInt32
const RENDERER_SOFTWARE = (UInt32)(1)
const RENDERER_ACCELERATED = (UInt32)(2)
const RENDERER_PRESENTVSYNC = (UInt32)(4)
const RENDERER_TARGETTEXTURE = (UInt32)(8)
# end enum ANONYMOUS_39

const RendererFlags = UInt32

mutable struct RendererInfo
    name::Cstring
    flags::Uint32
    num_texture_formats::Uint32
    texture_formats::NTuple{16, Uint32}
    max_texture_width::Cint
    max_texture_height::Cint
end

# begin enum ANONYMOUS_40
const ANONYMOUS_40 = UInt32
const TEXTUREACCESS_STATIC = (UInt32)(0)
const TEXTUREACCESS_STREAMING = (UInt32)(1)
const TEXTUREACCESS_TARGET = (UInt32)(2)
# end enum ANONYMOUS_40

const TextureAccess = UInt32

# begin enum ANONYMOUS_41
const ANONYMOUS_41 = UInt32
const TEXTUREMODULATE_NONE = (UInt32)(0)
const TEXTUREMODULATE_COLOR = (UInt32)(1)
const TEXTUREMODULATE_ALPHA = (UInt32)(2)
# end enum ANONYMOUS_41

const TextureModulate = UInt32

# begin enum ANONYMOUS_42
const ANONYMOUS_42 = UInt32
const FLIP_NONE = (UInt32)(0)
const FLIP_HORIZONTAL = (UInt32)(1)
const FLIP_VERTICAL = (UInt32)(2)
# end enum ANONYMOUS_42

const RendererFlip = UInt32

mutable struct Renderer
end

mutable struct Texture
end

const TimerCallback = Ptr{Cvoid}
const TimerID = Cint

mutable struct SDL_version
    major::Uint8
    minor::Uint8
    patch::Uint8
end


text:
using Conda

Conda.add("tensorflow")
Conda.pip_interop(true)
Conda.pip("install", "mhcflurry")

run(`$(Conda.BINDIR)/mhcflurry-downloads fetch`)

run(`$(Conda.BINDIR)/mhcflurry-downloads fetch models_class1_presentation`)

ext: jl


text:
# This file is needed for "Pkg.test()" to work for the test project.
# ("Pkg.test()" looks for "test/runtests.jl" in the project root.)
include(joinpath("..", "runtests.jl"))

max_issues_repo_name: maxbennedich/julia-regression-analysis

max_forks_repo_name: maxbennedich/julia-regression-analysis


text:
struct NullInfoState <: CounterfactualRegret.AbstractInfoState end
abstract type AbstractDeepCFRSolver{G} <: CFR.AbstractCFRSolver{Nothing,G,NullInfoState} end
mutable struct DeepCFRSolver{
        GPU,
        AN,
        SN,
        INFO,
        REGRET,
        STRAT,
        G <: Game,
        T,
        ADV_OPT <: Flux.Optimise.AbstractOptimiser,
        STRAT_OPT <: Flux.Optimise.AbstractOptimiser
    } <: AbstractDeepCFRSolver{G}
    gpu::Val{GPU}

    "Advantage networks"
    V::NTuple{2,AN}

    "Advantage memory"
    Mv::NTuple{2,AdvantageMemory{INFO, REGRET}}

    "Strategy Network"
    Π::SN

    "Strategy Memory"
    Mπ::StrategyMemory{INFO, STRAT}

    value_batches::Int
    strategy_batches::Int
    buffer_size::Int
    batch_size::Int
    traversals::Int
    traverser::T
    advantage_opt::ADV_OPT
    strategy_opt::STRAT_OPT
    game::G
    T::Float32
end

on_gpu(::DeepCFRSolver{GPU}) where GPU = GPU
infotype(::DeepCFRSolver{GPU,A,S,I}) where {GPU,A,S,I} = I
regrettype(::DeepCFRSolver{GPU,A,S,I,R}) where {GPU,A,S,I,R} = R
strattype(::DeepCFRSolver{GPU,A,S,I,R,ST}) where {GPU,A,S,I,R,ST} = ST

function in_out_sizes(game::Game)
    h0 = initialhist(game)
    k = vectorized(game, infokey(game, h0))
    A = actions(game, h0)
    in_size = length(k)
    out_size = length(A)
    return in_size, out_size
end

"""
`game::CounterfactualRegret.Game`

`value_batches::Int = 100` - Number of epochs for which value/advantage/regret networks are trained

`strategy_batches::Int = 1000` - Number of epochs for which strategy networks are trained

`buffer_size::Int = 100_000` - Capacity of memory buffers (both strategy and value)

`batch_size::Int = 512` - Batch size for each gradient update step (both strategy and value)

`traversals::Int = 100` - Number of MCCFR tree traversals to make for regret data collection between training steps

`traverser = ExternalSample()` - Type of MCCFR sampling used for tree traversal

`value_optimizer::Flux.Optimise.AbstractOptimiser` - value network optimizer

`strategy_optimizer::Flux.Optimise.AbstractOptimiser` - strategy network optimizer

`values` - Tuple of Flux.jl value networks (one network for each player)

`strategy` - Single Flux.jl strategy network

`on_gpu::Bool = false` - Option to push network training to GPU
"""
function DeepCFRSolver(game::Game{H,K};
    value_batches::Int = 100,
    strategy_batches::Int = 1000,
    buffer_size::Int = 100*10^3,
    batch_size::Int = 512,
    traverser = ExternalSample(),
    traversals::Int = 50,
    value_optimizer = ADAM(5e-3),
    strategy_optimizer = ADAM(5e-3),
    strategy = nothing,
    values::Union{Nothing, Tuple} = nothing,
    on_gpu::Bool = false
    ) where {H,K}

    VK = first(Base.return_types(vectorized, (typeof(game),K)))
    @assert VK <: AbstractVector "`vectorized(::Game{H,K}, ::K)` should return vector"

    #= Leave to checks
    if promote_type(eltype(VK), Float32) !== Float32
        @warn "Float32 eltype preferred for vectorized information state key"
    end
    =#

    in_size, out_size = in_out_sizes(game)
    value_nets = if isnothing(values)
        value_net = Chain(Dense(in_size, 16, sigmoid), Dense(16,out_size))
        (value_net, deepcopy(value_net))
    else
        values
    end

    strategy_net = if isnothing(strategy)
        Chain(
            Dense(in_size, 16, sigmoid),
            Dense(16, 16, sigmoid),
            Dense(16, out_size, sigmoid),
            softmax)
    else
        strategy
    end

    return DeepCFRSolver(
        Val(on_gpu),
        value_nets,
        (AdvantageMemory{VK}(buffer_size), AdvantageMemory{VK}(buffer_size)),
        strategy_net,
        StrategyMemory{VK}(buffer_size),
        value_batches,
        strategy_batches,
        buffer_size,
        batch_size,
        traversals,
        traverser,
        value_optimizer,
        strategy_optimizer,
        game,
        1.0f0
    )
end

function CFR.strategy(sol::DeepCFRSolver, I)
    game = sol.game
    if typeof(I) === infokeytype(game)
        return sol.Π(vectorized(game, I))
    else
        return sol.Π(I)
    end
end

(sol::DeepCFRSolver)(I) = CFR.strategy(sol, I)

function Base.show(io::IO, mime::MIME"text/plain", sol::DeepCFRSolver)
    Lv = length(first(sol.Mv))
    Lπ = length(sol.Mπ)
    sz = sol.buffer_size
    println(io, "\n\t Deep CFR Solver")
    println(io, join(fill('_', 20)))
    println(io, "GPU                 | \t $(on_gpu(sol))")
    println(io, "Advantage Net       | \t $(string(first(sol.V)))")
    println(io, "Advantage Memory    | \t $Lv / $sz")
    println(io, "Strategy Net        | \t $(string(sol.Π))")
    println(io, "Strategy Memory     | \t $Lπ / $sz")
    println(io, "Batch Size          | \t $(sol.batch_size)")
    println(io, "Traversals          | \t $(sol.traversals)")
    println(io, "Advantage Optimizer | \t $(typeof(sol.advantage_opt))")
    println(io, "Strategy Optimizer  | \t $(typeof(sol.strategy_opt))")
    println(io, "Game                | \t $(typeof(sol.game))")

    nothing
end


text:
function convert_arguments(P::PlotFunc, f::Analysis, args...; kwargs...)
    tmp = f(args...; kwargs...) |> to_tuple
    convert_arguments(P, tmp...)
end

adjust_globally(s::Analysis, traces) = s

used_attributes(P::PlotFunc, f::Function, g::GoG, args...) =
    Tuple(union((:colorrange,), used_attributes(P, f, args...)))

used_attributes(P::PlotFunc, g::GoG, args...) =
    Tuple(union((:colorrange,), used_attributes(P, args...)))

for typ in (:Function, :Analysis)
    @eval function convert_arguments(P::PlotFunc, f::($typ), arg::GoG, args...; kwargs...)
        convert_arguments(P, GrammarSpec((f, arg, args...)); kwargs...)
    end
end

convert_arguments(P::PlotFunc, arg::GoG, args...; kwargs...) =
    convert_arguments(P, tuple, arg, args...; kwargs...)

function to_plotspec(P::PlotFunc, g::TraceSpec, rks; kwargs...)
    plotspec = to_plotspec(P, convert_arguments(P, g.output...))
    names = propertynames(g.primary)
    d = Dict{Symbol, Node}()
    for (ind, key) in enumerate(names)
        f = function (user; palette = theme_scale)
            scale = is_scale(user) ? user : palette
            val = getproperty(g.primary, key)
            compute_attribute(scale, val, rks[ind])
        end
        d[key] = DelayedAttribute(f)
    end
    for (key, val) in node_pairs(kwargs)
        if !(key in names)
            d[key] = lift(t -> view(t, g.idxs), val)
        end
    end
    to_plotspec(P, plotspec; d...)
end

function convert_arguments(P::PlotFunc, gs::GrammarSpec; colorrange = automatic, kwargs...)
    traces, attributes = traces_attributes(gs)
    rks = rankdicts([trace.primary for trace in traces])
    series = (to_plotspec(P, trace, rks; attributes...) for trace in traces)
    pl = PlotList(series...)

    col = get(attributes, :color, nothing)
    if colorrange === automatic && col isa AbstractVector{<:Real}
        colorrange = extrema_nan(col)
    end

    PlotSpec{MultiplePlot}(pl, colorrange = colorrange)
end

struct DelayedAttribute
    f::Function
end

combine(theme_val, d::DelayedAttribute; palette = nothing, kwargs...) = d.f(theme_val; palette = palette)

max_stars_repo_name: piever/StatMakie

max_issues_repo_name: piever/StatMakie

max_forks_repo_name: piever/StatMakie


text:
export algorithmSourceCode

"""
Generate Julia code for message passing
and optional free energy evaluation
"""
function algorithmSourceCode(algo::InferenceAlgorithm; free_energy=false)
    algo_code = "begin\n\n"
    for (_, pf) in algo.posterior_factorization
        algo_code *= posteriorFactorSourceCode(pf)
        algo_code *= "\n\n"
    end

    if free_energy
        algo_code *= freeEnergySourceCode(algo)
        algo_code *= "\n\n"
    end

    algo_code *= "end # block"

    return algo_code
end

"""
Generate Julia code for free energy evaluation
"""
function freeEnergySourceCode(algo::InferenceAlgorithm)
    algo.posterior_factorization.free_energy_flag || error("Required quantities for free energy evaluation are not computed by the algorithm. Make sure to flag free_energy=true upon algorithm construction to schedule computation of required quantities.")

    fe_code  = "function freeEnergy$(algo.id)(data::Dict, marginals::Dict)\n\n"
    fe_code *= "F = 0.0\n\n"
    fe_code *= energiesSourceCode(algo.average_energies)
    fe_code *= "\n"
    fe_code *= entropiesSourceCode(algo.entropies)
    fe_code *= "\nreturn F\n\n"
    fe_code *= "end"

    return fe_code
end

"""
Generate Julia code for message passing on a single posterior factor
"""
function posteriorFactorSourceCode(pf::PosteriorFactor)
    pf_code = ""
    if pf.optimize
        pf_code *= optimizeSourceCode(pf)
        pf_code *= "\n\n"
    end

    if pf.initialize
        pf_code *= initializationSourceCode(pf)
        pf_code *= "\n\n"
    end

    n_entries = length(pf.schedule)
    pf_code *= "function step$(pf.algorithm_id)$(pf.id)!(data::Dict, marginals::Dict=Dict(), messages::Vector{Message}=Array{Message}(undef, $n_entries))\n\n"
    pf_code *= scheduleSourceCode(pf.schedule)
    pf_code *= "\n"
    pf_code *= marginalTableSourceCode(pf.marginal_table)
    pf_code *= "return marginals\n\n"
    pf_code *= "end"

    return pf_code
end

"""
Generate template code for optimize block
"""
function optimizeSourceCode(pf::PosteriorFactor)
    optim_code =  "# You have created an algorithm that requires updates for (a) clamped parameter(s).\n"
    optim_code *= "# This algorithm requires the definition of a custom `optimize!` function that updates the parameter value(s)\n"
    optim_code *= "# by altering the `data` dictionary in-place. The custom `optimize!` function may be based on the mockup below:\n\n"
    optim_code *= "# function optimize$(pf.algorithm_id)$(pf.id)!(data::Dict, marginals::Dict=Dict(), messages::Vector{Message}=init$(pf.algorithm_id)$(pf.id)())\n"
    optim_code *= "# \t...\n"
    optim_code *= "# \treturn data\n"
    optim_code *= "# end"

    return optim_code
end

"""
Generate code for initialization block (if required)
"""
function initializationSourceCode(pf::PosteriorFactor)
    init_code = "function init$(pf.algorithm_id)$(pf.id)()\n\n"

    n_messages = length(pf.schedule)

    init_code *= "messages = Array{Message}(undef, $n_messages)\n\n"

    for entry in pf.schedule
        if entry.initialize
            init_code *= "messages[$(entry.schedule_index)] = Message($(vagueSourceCode(entry)))\n"
        end
    end
    init_code *= "\nreturn messages\n\n"
    init_code *= "end"

    return init_code
end

"""
Generate code for evaluating the average energy
"""
function energiesSourceCode(average_energies::Vector)
    energies_code = ""
    for energy in average_energies
        count_code = countingNumberSourceCode(energy[:counting_number])
        node_code = removePrefix(energy[:node])
        inbounds_code = inboundsSourceCode(energy[:inbounds])

        energies_code *= "F += $(count_code)averageEnergy($node_code, $inbounds_code)\n"
    end

    return energies_code
end

"""
Generate code for evaluating the entropy
"""
function entropiesSourceCode(entropies::Vector)
    entropies_code = ""
    for entropy in entropies
        count_code = countingNumberSourceCode(entropy[:counting_number])
        inbound_code = inboundSourceCode(entropy[:inbound])

        entropies_code *= "F -= $(count_code)differentialEntropy($inbound_code)\n"
    end

    return entropies_code
end

"""
Generate code for counting number
"""
function countingNumberSourceCode(cnt::Int64)
    if cnt == 1
        count_code = ""
    else
        count_code = "$(cnt)*"
    end

    return count_code
end

"""
Construct code for message updates
"""
function scheduleSourceCode(schedule::Schedule)
    schedule_code = ""
    for entry in schedule
        rule_code = removePrefix(entry.message_update_rule)
        inbounds_code = inboundsSourceCode(entry.inbounds)
        schedule_code *= "messages[$(entry.schedule_index)] = rule$(rule_code)($inbounds_code)\n"
    end

    return schedule_code
end

"""
Generate code for marginal updates
"""
function marginalTableSourceCode(table::MarginalTable)
    table_code = ""
    for entry in table
        table_code *= "marginals[:$(entry.marginal_id)] = "
        if entry.marginal_update_rule == Nothing
            inbound = entry.inbounds[1]
            table_code *= "messages[$(inbound.schedule_index)].dist"
        elseif entry.marginal_update_rule == Product
            inbound1 = entry.inbounds[1]
            inbound2 = entry.inbounds[2]
            table_code *= "messages[$(inbound1.schedule_index)].dist * messages[$(inbound2.schedule_index)].dist"
        else
            rule_code = removePrefix(entry.marginal_update_rule)
            inbounds_code = inboundsSourceCode(entry.inbounds)
            table_code *= "rule$(rule_code)($inbounds_code)"
        end

        table_code *= "\n"
    end
    isempty(table_code) || (table_code *= "\n")

    return table_code
end

"""
Generate code for vague initializations
"""
function vagueSourceCode(entry::ScheduleEntry)
    family_code = removePrefix(entry.family)
    dims = entry.dimensionality
    if dims == ()
        vague_code = "vague($family_code)" # Default
    else
        vague_code = "vague($family_code, $dims)"
    end

    return vague_code
end

"""
Generate code for message/marginal/energy/entropy computation inbounds
"""
function inboundsSourceCode(inbounds::Vector)
    inbounds_code = String[]
    for inbound in inbounds
        push!(inbounds_code, inboundSourceCode(inbound))
    end
    return join(inbounds_code, ", ")
end

"""
Generate code for a single inbound (overloaded for specific inbound type)
"""
inboundSourceCode(inbound::Nothing) = "nothing"
inboundSourceCode(inbound::ScheduleEntry) = "messages[$(inbound.schedule_index)]"
inboundSourceCode(inbound::MarginalEntry) = "marginals[:$(inbound.marginal_id)]"
function inboundSourceCode(inbound::Dict) # Custom inbound
    keyword_flag = true # Default includes keyword in custom argument
    if haskey(inbound, :keyword)
        keyword_flag = inbound[:keyword]
    end

    inbound_code = ""
    for (key, val) in inbound
        if key != :keyword
            if keyword_flag
                inbound_code = "$(removePrefix(key))=$(removePrefix(val))"
            else
                inbound_code = removePrefix(val)
            end
        end
    end

    return inbound_code
end
function inboundSourceCode(inbound::Clamp{V}) where V<:VariateType # Buffer or value inbound
    dist_or_msg_code = removePrefix(inbound.dist_or_msg)
    variate_type_code = removePrefix(V)

    inbound_code = "$dist_or_msg_code($variate_type_code, PointMass, m="
    if isdefined(inbound, :buffer_id)
        # Inbound is read from buffer
        inbound_code *= "data[:$(inbound.buffer_id)]"
        if isdefined(inbound, :buffer_index) && (inbound.buffer_index > 0)
            inbound_code *= "[$(inbound.buffer_index)]"
        end
    else
        # Inbound is read from clamp node value
        inbound_code *= valueSourceCode(inbound.value)
    end
    inbound_code *= ")"

    return inbound_code
end

inboundSourceCode(inbound::Number) = string(inbound)

"""
Convert a value to parseable Julia code
"""
valueSourceCode(val::Union{Vector, Number}) = string(val)
valueSourceCode(val::Diagonal) = "Diagonal($(val.diag))"
function valueSourceCode(val::AbstractMatrix)
    # If the dimensionality in at least one direction is 1, a matrix needs to be
    # constructed explicitly; otherwise the output Julia code will construct a vector.
    d = size(val)
    if d == (1,1)
        val_code = "mat($(val[1]))" # Shorthand notation for a (1,1) matrix reshape
    elseif 1 in d
        val_code = "reshape($(vec(val)), $d)" # Explicit reshape
    else
        val_code = string(val)
    end

    return val_code
end

"""
Remove module prefixes from types and functions
"""
removePrefix(arg::Any) = arg # Do not remove prefix in general
removePrefix(tup::Tuple) = string(tup)
removePrefix(num::Number) = string(num)
removePrefix(vect::Vector) = string(vect)
removePrefix(func::Function) = split(string(func), '.')[end]
removePrefix(T::Type) = split(string(T), '.')[end]
function removePrefix(T::DataType)
    main_type_str = string(nameof(T)) # Strip leading module names and convert T to a string
    param_types = T.parameters # Find parameterized types of T
    if isempty(param_types) # If T is not parameterized further
        return main_type_str # Stop-condition, return main name
    else
        # Recursively build a vector of strings for the parameter types
        param_type_strs = []
        for param_type in param_types
            push!(param_type_strs, removePrefix(param_type)) # Recursive call
        end
        param_type_str = join(param_type_strs, ", ") # Join the constructed vector to a comma-separated string

        return "$main_type_str{$param_type_str}" # Construct the parameterized type string
    end
end