Skip to content

Commit

Permalink
all: fix `warning: unknown type C.XYZ (all virtual C types must be de…
Browse files Browse the repository at this point in the history
…fined, this will be an error soon).`
  • Loading branch information
larpon committed Oct 17, 2023
1 parent dde2198 commit f93538b
Show file tree
Hide file tree
Showing 18 changed files with 68 additions and 63 deletions.
6 changes: 3 additions & 3 deletions audio.c.v
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ pub fn open_audio_device(const_device &char, iscapture int, const_desired &Audio
allowed_changes))
}

fn C.SDL_OpenAudioDevice(const_device &char, iscapture int, const_desired &C.SDL_AudioSpec, obtained &C.SDL_AudioSpec, allowed_changes int) C.SDL_AudioDeviceID
fn C.SDL_OpenAudioDevice(const_device &char, iscapture int, const_desired &C.SDL_AudioSpec, obtained &C.SDL_AudioSpec, allowed_changes int) AudioDeviceID

// AudioStatus
//
Expand All @@ -669,7 +669,7 @@ pub enum AudioStatus {
audio_paused = C.SDL_AUDIO_PAUSED
}

fn C.SDL_GetAudioStatus() C.SDL_AudioStatus
fn C.SDL_GetAudioStatus() AudioStatus

// get_audio_status is a legacy means of querying the audio device.
//
Expand All @@ -691,7 +691,7 @@ pub fn get_audio_status() AudioStatus {
return AudioStatus(C.SDL_GetAudioStatus())
}

fn C.SDL_GetAudioDeviceStatus(dev C.SDL_AudioDeviceID) C.SDL_AudioStatus
fn C.SDL_GetAudioDeviceStatus(dev C.SDL_AudioDeviceID) AudioStatus

// get_audio_device_status gets the current audio state of an audio device.
//
Expand Down
2 changes: 1 addition & 1 deletion blendmode.c.v
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ pub enum BlendFactor {
one_minus_dst_alpha = C.SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA // 0xA, 1-dstA, 1-dstA, 1-dstA, 1-dstA
}

fn C.SDL_ComposeCustomBlendMode(src_color_factor C.SDL_BlendFactor, dst_color_factor C.SDL_BlendFactor, color_operation C.SDL_BlendOperation, src_alpha_factor C.SDL_BlendFactor, dst_alpha_factor C.SDL_BlendFactor, alpha_operation C.SDL_BlendOperation) C.SDL_BlendMode
fn C.SDL_ComposeCustomBlendMode(src_color_factor C.SDL_BlendFactor, dst_color_factor C.SDL_BlendFactor, color_operation C.SDL_BlendOperation, src_alpha_factor C.SDL_BlendFactor, dst_alpha_factor C.SDL_BlendFactor, alpha_operation C.SDL_BlendOperation) BlendMode

// compose_custom_blend_mode composes a custom blend mode for renderers.
//
Expand Down
20 changes: 10 additions & 10 deletions events.c.v
Original file line number Diff line number Diff line change
Expand Up @@ -373,10 +373,10 @@ pub type JoyDeviceEvent = C.SDL_JoyDeviceEvent
// JoyBatteryEvent is joysick battery level change event structure (event.jbattery.*)
[typedef]
pub struct C.SDL_JoyBatteryEvent {
@type u32 // ::SDL_JOYBATTERYUPDATED
timestamp u32 // In milliseconds, populated using SDL_GetTicks()
which C.SDL_JoystickID // The joystick instance id
level C.SDL_JoystickPowerLevel // The joystick battery level
@type u32 // ::SDL_JOYBATTERYUPDATED
timestamp u32 // In milliseconds, populated using SDL_GetTicks()
which JoystickID // The joystick instance id
level JoystickPowerLevel // The joystick battery level
}

pub type JoyBatteryEvent = C.SDL_JoyBatteryEvent
Expand Down Expand Up @@ -443,12 +443,12 @@ pub type ControllerTouchpadEvent = C.SDL_ControllerTouchpadEvent
[typedef]
pub struct C.SDL_ControllerSensorEvent {
pub:
@type u32 // ::SDL_CONTROLLERSENSORUPDATE
timestamp u32 // In milliseconds, populated using SDL_GetTicks()
which C.SDL_JoystickID // The joystick instance id
sensor int // The type of the sensor, one of the values of ::SDL_SensorType
data [3]f32 // Up to 3 values from the sensor, as defined in SDL_sensor.h
timestamp_us u64 // The timestamp of the sensor reading in microseconds, if the hardware provides this information.
@type u32 // ::SDL_CONTROLLERSENSORUPDATE
timestamp u32 // In milliseconds, populated using SDL_GetTicks()
which JoystickID // The joystick instance id
sensor int // The type of the sensor, one of the values of ::SDL_SensorType
data [3]f32 // Up to 3 values from the sensor, as defined in SDL_sensor.h
timestamp_us u64 // The timestamp of the sensor reading in microseconds, if the hardware provides this information.
}

pub type ControllerSensorEvent = C.SDL_ControllerSensorEvent
Expand Down
16 changes: 8 additions & 8 deletions gamecontroller.c.v
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ pub fn game_controller_path_for_index(joystick_index int) &char {
return C.SDL_GameControllerPathForIndex(joystick_index)
}

fn C.SDL_GameControllerTypeForIndex(joystick_index int) C.SDL_GameControllerType
fn C.SDL_GameControllerTypeForIndex(joystick_index int) GameControllerType

// game_controller_type_for_index gets the type of a game controller.
//
Expand Down Expand Up @@ -431,7 +431,7 @@ pub fn game_controller_path(gamecontroller &GameController) &char {
return C.SDL_GameControllerPath(gamecontroller)
}

fn C.SDL_GameControllerGetType(gamecontroller &C.SDL_GameController) C.SDL_GameControllerType
fn C.SDL_GameControllerGetType(gamecontroller &C.SDL_GameController) GameControllerType

// game_controller_get_type gets the type of this currently opened controller
//
Expand Down Expand Up @@ -639,7 +639,7 @@ pub enum GameControllerAxis {
max = C.SDL_CONTROLLER_AXIS_MAX
}

fn C.SDL_GameControllerGetAxisFromString(const_str &char) C.SDL_GameControllerAxis
fn C.SDL_GameControllerGetAxisFromString(const_str &char) GameControllerAxis

// game_controller_get_axis_from_string converts a string into SDL_GameControllerAxis enum.
//
Expand Down Expand Up @@ -763,7 +763,7 @@ pub enum GameControllerButton {
max = C.SDL_CONTROLLER_BUTTON_MAX
}

fn C.SDL_GameControllerGetButtonFromString(const_str &char) C.SDL_GameControllerButton
fn C.SDL_GameControllerGetButtonFromString(const_str &char) GameControllerButton

// game_controller_get_button_from_string converts a string into an SDL_GameControllerButton enum.
//
Expand Down Expand Up @@ -1109,7 +1109,7 @@ pub fn game_controller_close(gamecontroller &GameController) {
C.SDL_GameControllerClose(gamecontroller)
}

fn C.SDL_GameControllerGetAppleSFSymbolsNameForButton(gamecontroller &C.SDL_GameController, button C.SDL_GameControllerButton) &char
fn C.SDL_GameControllerGetAppleSFSymbolsNameForButton(gamecontroller &GameController, button GameControllerButton) &char

// game_controller_get_apple_sf_symbols_name_for_button returns the sfSymbolsName for a given button on a game controller on Apple
// platforms.
Expand All @@ -1121,11 +1121,11 @@ fn C.SDL_GameControllerGetAppleSFSymbolsNameForButton(gamecontroller &C.SDL_Game
// NOTE This function is available since SDL 2.0.18.
//
// See also: SDL_GameControllerGetAppleSFSymbolsNameForAxis
pub fn game_controller_get_apple_sf_symbols_name_for_button(gamecontroller &C.SDL_GameController, button C.SDL_GameControllerButton) &char {
pub fn game_controller_get_apple_sf_symbols_name_for_button(gamecontroller &GameController, button GameControllerButton) &char {
return C.SDL_GameControllerGetAppleSFSymbolsNameForButton(gamecontroller, button)
}

fn C.SDL_GameControllerGetAppleSFSymbolsNameForAxis(gamecontroller &C.SDL_GameController, axis C.SDL_GameControllerAxis) &char
fn C.SDL_GameControllerGetAppleSFSymbolsNameForAxis(gamecontroller &GameController, axis GameControllerAxis) &char

// game_controller_get_apple_sf_symbols_name_for_axis returns the sfSymbolsName for a given axis on a game controller on Apple
// platforms.
Expand All @@ -1137,6 +1137,6 @@ fn C.SDL_GameControllerGetAppleSFSymbolsNameForAxis(gamecontroller &C.SDL_GameCo
// NOTE This function is available since SDL 2.0.18.
//
// See also: SDL_GameControllerGetAppleSFSymbolsNameForButton
pub fn game_controller_get_apple_sf_symbols_name_for_axis(gamecontroller &C.SDL_GameController, axis C.SDL_GameControllerAxis) &char {
pub fn game_controller_get_apple_sf_symbols_name_for_axis(gamecontroller &GameController, axis GameControllerAxis) &char {
return C.SDL_GameControllerGetAppleSFSymbolsNameForAxis(gamecontroller, axis)
}
20 changes: 10 additions & 10 deletions joystick.c.v
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ pub enum JoystickType {
throttle
}

// C.SDL_JoystickID // Sint32 / int
pub type JoystickID = int
// C.SDL_JoystickID // Sint32
pub type JoystickID = i32

// JoystickPowerLevel is C.SDL_JoystickPowerLevel
pub enum JoystickPowerLevel {
Expand Down Expand Up @@ -237,7 +237,7 @@ pub fn joystick_get_device_product_version(device_index int) u16 {
return C.SDL_JoystickGetDeviceProductVersion(device_index)
}

fn C.SDL_JoystickGetDeviceType(device_index int) C.SDL_JoystickType
fn C.SDL_JoystickGetDeviceType(device_index int) JoystickType

// joystick_get_device_type gets the type of a joystick, if available.
//
Expand All @@ -253,7 +253,7 @@ pub fn joystick_get_device_type(device_index int) JoystickType {
return unsafe { JoystickType(int(C.SDL_JoystickGetDeviceType(device_index))) }
}

fn C.SDL_JoystickGetDeviceInstanceID(device_index int) C.SDL_JoystickID
fn C.SDL_JoystickGetDeviceInstanceID(device_index int) JoystickID

// joystick_get_device_instance_id gets the instance ID of a joystick.
//
Expand Down Expand Up @@ -615,7 +615,7 @@ pub fn joystick_get_serial(joystick &Joystick) &char {
return C.SDL_JoystickGetSerial(joystick)
}

fn C.SDL_JoystickGetType(joystick &C.SDL_Joystick) C.SDL_JoystickType
fn C.SDL_JoystickGetType(joystick &C.SDL_Joystick) JoystickType

// joystick_get_type gets the type of an opened joystick.
//
Expand Down Expand Up @@ -646,7 +646,7 @@ pub fn joystick_get_guid_string(guid JoystickGUID, psz_guid &char, cb_guid int)
C.SDL_JoystickGetGUIDString(C.SDL_JoystickGUID(guid), psz_guid, cb_guid)
}

fn C.SDL_JoystickGetGUIDFromString(pch_guid &char) C.SDL_JoystickGUID
fn C.SDL_JoystickGetGUIDFromString(pch_guid &char) JoystickGUID

// joystick_get_guid_from_string converts a GUID string into a SDL_JoystickGUID structure.
//
Expand All @@ -660,7 +660,7 @@ fn C.SDL_JoystickGetGUIDFromString(pch_guid &char) C.SDL_JoystickGUID
// NOTE This function is available since SDL 2.0.0.
//
// See also: SDL_JoystickGetGUIDString
pub fn joystick_get_guid_from_string(pch_guid &char) C.SDL_JoystickGUID {
pub fn joystick_get_guid_from_string(pch_guid &char) JoystickGUID {
return C.SDL_JoystickGetGUIDFromString(pch_guid)
}

Expand Down Expand Up @@ -701,7 +701,7 @@ pub fn joystick_get_attached(joystick &Joystick) bool {
return C.SDL_JoystickGetAttached(joystick)
}

fn C.SDL_JoystickInstanceID(joystick &C.SDL_Joystick) C.SDL_JoystickID
fn C.SDL_JoystickInstanceID(joystick &C.SDL_Joystick) JoystickID

// joystick_instance_id gets the instance ID of an opened joystick.
//
Expand All @@ -712,7 +712,7 @@ fn C.SDL_JoystickInstanceID(joystick &C.SDL_Joystick) C.SDL_JoystickID
// NOTE This function is available since SDL 2.0.0.
//
// See also: SDL_JoystickOpen
pub fn joystick_instance_id(joystick &Joystick) C.SDL_JoystickID {
pub fn joystick_instance_id(joystick &Joystick) JoystickID {
return C.SDL_JoystickInstanceID(joystick)
}

Expand Down Expand Up @@ -1078,7 +1078,7 @@ pub fn joystick_close(joystick &Joystick) {
C.SDL_JoystickClose(joystick)
}

fn C.SDL_JoystickCurrentPowerLevel(joystick &C.SDL_Joystick) C.SDL_JoystickPowerLevel
fn C.SDL_JoystickCurrentPowerLevel(joystick &C.SDL_Joystick) JoystickPowerLevel

// joystick_current_power_level gets the battery level of a joystick as SDL_JoystickPowerLevel.
//
Expand Down
10 changes: 5 additions & 5 deletions keyboard.c.v
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ pub fn reset_keyboard() {
C.SDL_ResetKeyboard()
}

fn C.SDL_GetModState() C.SDL_Keymod
fn C.SDL_GetModState() Keymod

// get_mod_state gets the current key modifier state for the keyboard.
//
Expand Down Expand Up @@ -115,7 +115,7 @@ pub fn set_mod_state(modstate Keymod) {
C.SDL_SetModState(C.SDL_Keymod(modstate))
}

fn C.SDL_GetKeyFromScancode(scancode C.SDL_Scancode) C.SDL_Keycode
fn C.SDL_GetKeyFromScancode(scancode C.SDL_Scancode) Keycode

// get_key_from_scancode gets the key code corresponding to the given scancode according to the
// current keyboard layout.
Expand All @@ -133,7 +133,7 @@ pub fn get_key_from_scancode(scancode Scancode) Keycode {
return Keycode(int(C.SDL_GetKeyFromScancode(C.SDL_Scancode(scancode))))
}

fn C.SDL_GetScancodeFromKey(key C.SDL_Keycode) C.SDL_Scancode
fn C.SDL_GetScancodeFromKey(key C.SDL_Keycode) Scancode

// get_scancode_from_key gets the scancode corresponding to the given key code according to the
// current keyboard layout.
Expand Down Expand Up @@ -178,7 +178,7 @@ pub fn get_scancode_name(scancode Scancode) &char {
return C.SDL_GetScancodeName(C.SDL_Scancode(scancode))
}

fn C.SDL_GetScancodeFromName(name &char) C.SDL_Scancode
fn C.SDL_GetScancodeFromName(name &char) Scancode

// get_scancode_from_name gets a scancode from a human-readable name.
//
Expand Down Expand Up @@ -216,7 +216,7 @@ pub fn get_key_name(key Keycode) &char {
return C.SDL_GetKeyName(C.SDL_Keycode(key))
}

fn C.SDL_GetKeyFromName(name &char) C.SDL_Keycode
fn C.SDL_GetKeyFromName(name &char) Keycode

// get_key_from_name gets a key code from a human-readable name.
//
Expand Down
2 changes: 1 addition & 1 deletion log.c.v
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ pub fn log_set_priority(category int, priority LogPriority) {
C.SDL_LogSetPriority(category, C.SDL_LogPriority(int(priority)))
}

fn C.SDL_LogGetPriority(category int) C.SDL_LogPriority
fn C.SDL_LogGetPriority(category int) LogPriority

// log_get_priority gets the priority of a particular log category.
//
Expand Down
2 changes: 1 addition & 1 deletion metal.c.v
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module sdl
pub type MetalView = voidptr

// Metal support functions
fn C.SDL_Metal_CreateView(window &C.SDL_Window) C.SDL_MetalView
fn C.SDL_Metal_CreateView(window &C.SDL_Window) MetalView

// metal_create_view creates a CAMetalLayer-backed NSView/UIView and attach it to the specified
// window.
Expand Down
6 changes: 3 additions & 3 deletions mixer/mixer.c.v
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ pub fn has_music_decoder(name &char) bool {
}
*/

fn C.Mix_GetMusicType(music &C.Mix_Music) C.Mix_MusicType
fn C.Mix_GetMusicType(music &C.Mix_Music) MusicType

// get_music_type finds out the music format of a mixer music, or the currently playing
// music, if 'music' is NULL.
Expand Down Expand Up @@ -749,14 +749,14 @@ pub fn fade_out_music(ms int) int {
return C.Mix_FadeOutMusic(ms)
}

fn C.Mix_FadingMusic() C.Mix_Fading
fn C.Mix_FadingMusic() Fading

// fading_music queries the fading status of a channel
pub fn fading_music() Fading {
return Fading(C.Mix_FadingMusic())
}

fn C.Mix_FadingChannel(which int) C.Mix_Fading
fn C.Mix_FadingChannel(which int) Fading
pub fn fading_channel(which int) Fading {
return Fading(C.Mix_FadingChannel(which))
}
Expand Down
2 changes: 1 addition & 1 deletion power.c.v
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub enum PowerState {
charged = C.SDL_POWERSTATE_CHARGED // Plugged in, battery charged
}

fn C.SDL_GetPowerInfo(seconds &int, percent &int) C.SDL_PowerState
fn C.SDL_GetPowerInfo(seconds &int, percent &int) PowerState

// get_power_info gets the current power supply details.
//
Expand Down
12 changes: 6 additions & 6 deletions sensor.c.v
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ pub fn sensor_get_device_name(device_index int) &char {
return C.SDL_SensorGetDeviceName(device_index)
}

fn C.SDL_SensorGetDeviceType(device_index int) C.SDL_SensorType
fn C.SDL_SensorGetDeviceType(device_index int) SensorType

// sensor_get_device_type gets the type of a sensor.
//
Expand All @@ -164,7 +164,7 @@ pub fn sensor_get_device_non_portable_type(device_index int) int {
return C.SDL_SensorGetDeviceNonPortableType(device_index)
}

fn C.SDL_SensorGetDeviceInstanceID(device_index int) C.SDL_SensorID
fn C.SDL_SensorGetDeviceInstanceID(device_index int) SensorID

// sensor_get_device_instance_id gets the instance ID of a sensor.
//
Expand All @@ -188,15 +188,15 @@ pub fn sensor_open(device_index int) &Sensor {
return C.SDL_SensorOpen(device_index)
}

fn C.SDL_SensorFromInstanceID(instance_id C.SDL_SensorID) &C.SDL_Sensor
fn C.SDL_SensorFromInstanceID(instance_id SensorID) &Sensor

// sensor_from_instance_id returns the SDL_Sensor associated with an instance id.
//
// `instance_id` The sensor from instance id
// returns an SDL_Sensor object.
//
// NOTE This function is available since SDL 2.0.9.
pub fn sensor_from_instance_id(instance_id C.SDL_SensorID) &Sensor {
pub fn sensor_from_instance_id(instance_id SensorID) &Sensor {
return C.SDL_SensorFromInstanceID(instance_id)
}

Expand All @@ -212,7 +212,7 @@ pub fn sensor_get_name(sensor &Sensor) &char {
return C.SDL_SensorGetName(sensor)
}

fn C.SDL_SensorGetType(sensor &C.SDL_Sensor) C.SDL_SensorType
fn C.SDL_SensorGetType(sensor &C.SDL_Sensor) SensorType

// sensor_get_type gets the type of a sensor.
//
Expand All @@ -237,7 +237,7 @@ pub fn sensor_get_non_portable_type(sensor &Sensor) int {
return C.SDL_SensorGetNonPortableType(sensor)
}

fn C.SDL_SensorGetInstanceID(sensor &C.SDL_Sensor) C.SDL_SensorID
fn C.SDL_SensorGetInstanceID(sensor &C.SDL_Sensor) SensorID

// sensor_get_instance_id gets the instance ID of a sensor.
//
Expand Down
8 changes: 4 additions & 4 deletions stdinc.c.v
Original file line number Diff line number Diff line change
Expand Up @@ -448,8 +448,8 @@ pub fn ultoa(value u32, str &char, radix int) &char {
return C.SDL_ultoa(value, str, radix)
}

fn C.SDL_lltoa(value C.Sint64, str &char, radix int) &char
pub fn lltoa(value C.Sint64, str &char, radix int) &char {
fn C.SDL_lltoa(value i64, str &char, radix int) &char
pub fn lltoa(value i64, str &char, radix int) &char {
return C.SDL_lltoa(value, str, radix)
}

Expand Down Expand Up @@ -478,8 +478,8 @@ pub fn strtoul(str &char, endp &&char, base int) u32 {
return C.SDL_strtoul(str, endp, base)
}

fn C.SDL_strtoll(str &char, endp &&char, base int) C.Sint64
pub fn strtoll(str &char, endp &&char, base int) C.Sint64 {
fn C.SDL_strtoll(str &char, endp &&char, base int) i64
pub fn strtoll(str &char, endp &&char, base int) i64 {
return C.SDL_strtoll(str, endp, base)
}

Expand Down
Loading

0 comments on commit f93538b

Please sign in to comment.