Skip to content

Commit c20edb6

Browse files
authored
all: fix warning: unknown type C.XYZ (all virtual C types must be defined, ...) (#595)
1 parent dde2198 commit c20edb6

18 files changed

+69
-64
lines changed

a_types.c.v

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module sdl
2+
3+
// va_list
4+
[typedef]
5+
pub struct C.va_list {}

audio.c.v

+4-4
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,7 @@ pub fn open_audio_device(const_device &char, iscapture int, const_desired &Audio
655655
allowed_changes))
656656
}
657657

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

660660
// AudioStatus
661661
//
@@ -669,7 +669,7 @@ pub enum AudioStatus {
669669
audio_paused = C.SDL_AUDIO_PAUSED
670670
}
671671

672-
fn C.SDL_GetAudioStatus() C.SDL_AudioStatus
672+
fn C.SDL_GetAudioStatus() AudioStatus
673673

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

694-
fn C.SDL_GetAudioDeviceStatus(dev C.SDL_AudioDeviceID) C.SDL_AudioStatus
694+
fn C.SDL_GetAudioDeviceStatus(dev AudioDeviceID) AudioStatus
695695

696696
// get_audio_device_status gets the current audio state of an audio device.
697697
//
@@ -703,7 +703,7 @@ fn C.SDL_GetAudioDeviceStatus(dev C.SDL_AudioDeviceID) C.SDL_AudioStatus
703703
//
704704
// See also: SDL_PauseAudioDevice
705705
pub fn get_audio_device_status(dev AudioDeviceID) AudioStatus {
706-
return AudioStatus(C.SDL_GetAudioDeviceStatus(C.SDL_AudioDeviceID(dev)))
706+
return AudioStatus(C.SDL_GetAudioDeviceStatus(dev))
707707
}
708708

709709
// Pause audio functions

blendmode.c.v

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ pub enum BlendFactor {
4343
one_minus_dst_alpha = C.SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA // 0xA, 1-dstA, 1-dstA, 1-dstA, 1-dstA
4444
}
4545

46-
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
46+
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
4747

4848
// compose_custom_blend_mode composes a custom blend mode for renderers.
4949
//

events.c.v

+10-10
Original file line numberDiff line numberDiff line change
@@ -373,10 +373,10 @@ pub type JoyDeviceEvent = C.SDL_JoyDeviceEvent
373373
// JoyBatteryEvent is joysick battery level change event structure (event.jbattery.*)
374374
[typedef]
375375
pub struct C.SDL_JoyBatteryEvent {
376-
@type u32 // ::SDL_JOYBATTERYUPDATED
377-
timestamp u32 // In milliseconds, populated using SDL_GetTicks()
378-
which C.SDL_JoystickID // The joystick instance id
379-
level C.SDL_JoystickPowerLevel // The joystick battery level
376+
@type u32 // ::SDL_JOYBATTERYUPDATED
377+
timestamp u32 // In milliseconds, populated using SDL_GetTicks()
378+
which JoystickID // The joystick instance id
379+
level JoystickPowerLevel // The joystick battery level
380380
}
381381

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

454454
pub type ControllerSensorEvent = C.SDL_ControllerSensorEvent

gamecontroller.c.v

+8-8
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ pub fn game_controller_path_for_index(joystick_index int) &char {
303303
return C.SDL_GameControllerPathForIndex(joystick_index)
304304
}
305305

306-
fn C.SDL_GameControllerTypeForIndex(joystick_index int) C.SDL_GameControllerType
306+
fn C.SDL_GameControllerTypeForIndex(joystick_index int) GameControllerType
307307

308308
// game_controller_type_for_index gets the type of a game controller.
309309
//
@@ -431,7 +431,7 @@ pub fn game_controller_path(gamecontroller &GameController) &char {
431431
return C.SDL_GameControllerPath(gamecontroller)
432432
}
433433

434-
fn C.SDL_GameControllerGetType(gamecontroller &C.SDL_GameController) C.SDL_GameControllerType
434+
fn C.SDL_GameControllerGetType(gamecontroller &C.SDL_GameController) GameControllerType
435435

436436
// game_controller_get_type gets the type of this currently opened controller
437437
//
@@ -639,7 +639,7 @@ pub enum GameControllerAxis {
639639
max = C.SDL_CONTROLLER_AXIS_MAX
640640
}
641641

642-
fn C.SDL_GameControllerGetAxisFromString(const_str &char) C.SDL_GameControllerAxis
642+
fn C.SDL_GameControllerGetAxisFromString(const_str &char) GameControllerAxis
643643

644644
// game_controller_get_axis_from_string converts a string into SDL_GameControllerAxis enum.
645645
//
@@ -763,7 +763,7 @@ pub enum GameControllerButton {
763763
max = C.SDL_CONTROLLER_BUTTON_MAX
764764
}
765765

766-
fn C.SDL_GameControllerGetButtonFromString(const_str &char) C.SDL_GameControllerButton
766+
fn C.SDL_GameControllerGetButtonFromString(const_str &char) GameControllerButton
767767

768768
// game_controller_get_button_from_string converts a string into an SDL_GameControllerButton enum.
769769
//
@@ -1109,7 +1109,7 @@ pub fn game_controller_close(gamecontroller &GameController) {
11091109
C.SDL_GameControllerClose(gamecontroller)
11101110
}
11111111

1112-
fn C.SDL_GameControllerGetAppleSFSymbolsNameForButton(gamecontroller &C.SDL_GameController, button C.SDL_GameControllerButton) &char
1112+
fn C.SDL_GameControllerGetAppleSFSymbolsNameForButton(gamecontroller &GameController, button GameControllerButton) &char
11131113

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

1128-
fn C.SDL_GameControllerGetAppleSFSymbolsNameForAxis(gamecontroller &C.SDL_GameController, axis C.SDL_GameControllerAxis) &char
1128+
fn C.SDL_GameControllerGetAppleSFSymbolsNameForAxis(gamecontroller &GameController, axis GameControllerAxis) &char
11291129

11301130
// game_controller_get_apple_sf_symbols_name_for_axis returns the sfSymbolsName for a given axis on a game controller on Apple
11311131
// platforms.
@@ -1137,6 +1137,6 @@ fn C.SDL_GameControllerGetAppleSFSymbolsNameForAxis(gamecontroller &C.SDL_GameCo
11371137
// NOTE This function is available since SDL 2.0.18.
11381138
//
11391139
// See also: SDL_GameControllerGetAppleSFSymbolsNameForButton
1140-
pub fn game_controller_get_apple_sf_symbols_name_for_axis(gamecontroller &C.SDL_GameController, axis C.SDL_GameControllerAxis) &char {
1140+
pub fn game_controller_get_apple_sf_symbols_name_for_axis(gamecontroller &GameController, axis GameControllerAxis) &char {
11411141
return C.SDL_GameControllerGetAppleSFSymbolsNameForAxis(gamecontroller, axis)
11421142
}

joystick.c.v

+10-10
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ pub enum JoystickType {
4747
throttle
4848
}
4949

50-
// C.SDL_JoystickID // Sint32 / int
51-
pub type JoystickID = int
50+
// C.SDL_JoystickID // Sint32
51+
pub type JoystickID = i32
5252

5353
// JoystickPowerLevel is C.SDL_JoystickPowerLevel
5454
pub enum JoystickPowerLevel {
@@ -237,7 +237,7 @@ pub fn joystick_get_device_product_version(device_index int) u16 {
237237
return C.SDL_JoystickGetDeviceProductVersion(device_index)
238238
}
239239

240-
fn C.SDL_JoystickGetDeviceType(device_index int) C.SDL_JoystickType
240+
fn C.SDL_JoystickGetDeviceType(device_index int) JoystickType
241241

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

256-
fn C.SDL_JoystickGetDeviceInstanceID(device_index int) C.SDL_JoystickID
256+
fn C.SDL_JoystickGetDeviceInstanceID(device_index int) JoystickID
257257

258258
// joystick_get_device_instance_id gets the instance ID of a joystick.
259259
//
@@ -615,7 +615,7 @@ pub fn joystick_get_serial(joystick &Joystick) &char {
615615
return C.SDL_JoystickGetSerial(joystick)
616616
}
617617

618-
fn C.SDL_JoystickGetType(joystick &C.SDL_Joystick) C.SDL_JoystickType
618+
fn C.SDL_JoystickGetType(joystick &C.SDL_Joystick) JoystickType
619619

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

649-
fn C.SDL_JoystickGetGUIDFromString(pch_guid &char) C.SDL_JoystickGUID
649+
fn C.SDL_JoystickGetGUIDFromString(pch_guid &char) JoystickGUID
650650

651651
// joystick_get_guid_from_string converts a GUID string into a SDL_JoystickGUID structure.
652652
//
@@ -660,7 +660,7 @@ fn C.SDL_JoystickGetGUIDFromString(pch_guid &char) C.SDL_JoystickGUID
660660
// NOTE This function is available since SDL 2.0.0.
661661
//
662662
// See also: SDL_JoystickGetGUIDString
663-
pub fn joystick_get_guid_from_string(pch_guid &char) C.SDL_JoystickGUID {
663+
pub fn joystick_get_guid_from_string(pch_guid &char) JoystickGUID {
664664
return C.SDL_JoystickGetGUIDFromString(pch_guid)
665665
}
666666

@@ -701,7 +701,7 @@ pub fn joystick_get_attached(joystick &Joystick) bool {
701701
return C.SDL_JoystickGetAttached(joystick)
702702
}
703703

704-
fn C.SDL_JoystickInstanceID(joystick &C.SDL_Joystick) C.SDL_JoystickID
704+
fn C.SDL_JoystickInstanceID(joystick &C.SDL_Joystick) JoystickID
705705

706706
// joystick_instance_id gets the instance ID of an opened joystick.
707707
//
@@ -712,7 +712,7 @@ fn C.SDL_JoystickInstanceID(joystick &C.SDL_Joystick) C.SDL_JoystickID
712712
// NOTE This function is available since SDL 2.0.0.
713713
//
714714
// See also: SDL_JoystickOpen
715-
pub fn joystick_instance_id(joystick &Joystick) C.SDL_JoystickID {
715+
pub fn joystick_instance_id(joystick &Joystick) JoystickID {
716716
return C.SDL_JoystickInstanceID(joystick)
717717
}
718718

@@ -1078,7 +1078,7 @@ pub fn joystick_close(joystick &Joystick) {
10781078
C.SDL_JoystickClose(joystick)
10791079
}
10801080

1081-
fn C.SDL_JoystickCurrentPowerLevel(joystick &C.SDL_Joystick) C.SDL_JoystickPowerLevel
1081+
fn C.SDL_JoystickCurrentPowerLevel(joystick &C.SDL_Joystick) JoystickPowerLevel
10821082

10831083
// joystick_current_power_level gets the battery level of a joystick as SDL_JoystickPowerLevel.
10841084
//

keyboard.c.v

+5-5
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ pub fn reset_keyboard() {
7979
C.SDL_ResetKeyboard()
8080
}
8181

82-
fn C.SDL_GetModState() C.SDL_Keymod
82+
fn C.SDL_GetModState() Keymod
8383

8484
// get_mod_state gets the current key modifier state for the keyboard.
8585
//
@@ -115,7 +115,7 @@ pub fn set_mod_state(modstate Keymod) {
115115
C.SDL_SetModState(C.SDL_Keymod(modstate))
116116
}
117117

118-
fn C.SDL_GetKeyFromScancode(scancode C.SDL_Scancode) C.SDL_Keycode
118+
fn C.SDL_GetKeyFromScancode(scancode C.SDL_Scancode) Keycode
119119

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

136-
fn C.SDL_GetScancodeFromKey(key C.SDL_Keycode) C.SDL_Scancode
136+
fn C.SDL_GetScancodeFromKey(key C.SDL_Keycode) Scancode
137137

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

181-
fn C.SDL_GetScancodeFromName(name &char) C.SDL_Scancode
181+
fn C.SDL_GetScancodeFromName(name &char) Scancode
182182

183183
// get_scancode_from_name gets a scancode from a human-readable name.
184184
//
@@ -216,7 +216,7 @@ pub fn get_key_name(key Keycode) &char {
216216
return C.SDL_GetKeyName(C.SDL_Keycode(key))
217217
}
218218

219-
fn C.SDL_GetKeyFromName(name &char) C.SDL_Keycode
219+
fn C.SDL_GetKeyFromName(name &char) Keycode
220220

221221
// get_key_from_name gets a key code from a human-readable name.
222222
//

log.c.v

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ pub fn log_set_priority(category int, priority LogPriority) {
9494
C.SDL_LogSetPriority(category, C.SDL_LogPriority(int(priority)))
9595
}
9696

97-
fn C.SDL_LogGetPriority(category int) C.SDL_LogPriority
97+
fn C.SDL_LogGetPriority(category int) LogPriority
9898

9999
// log_get_priority gets the priority of a particular log category.
100100
//

metal.c.v

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ module sdl
1616
pub type MetalView = voidptr
1717

1818
// Metal support functions
19-
fn C.SDL_Metal_CreateView(window &C.SDL_Window) C.SDL_MetalView
19+
fn C.SDL_Metal_CreateView(window &C.SDL_Window) MetalView
2020

2121
// metal_create_view creates a CAMetalLayer-backed NSView/UIView and attach it to the specified
2222
// window.

mixer/mixer.c.v

+3-3
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ pub fn has_music_decoder(name &char) bool {
277277
}
278278
*/
279279

280-
fn C.Mix_GetMusicType(music &C.Mix_Music) C.Mix_MusicType
280+
fn C.Mix_GetMusicType(music &C.Mix_Music) MusicType
281281

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

752-
fn C.Mix_FadingMusic() C.Mix_Fading
752+
fn C.Mix_FadingMusic() Fading
753753

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

759-
fn C.Mix_FadingChannel(which int) C.Mix_Fading
759+
fn C.Mix_FadingChannel(which int) Fading
760760
pub fn fading_channel(which int) Fading {
761761
return Fading(C.Mix_FadingChannel(which))
762762
}

power.c.v

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub enum PowerState {
1717
charged = C.SDL_POWERSTATE_CHARGED // Plugged in, battery charged
1818
}
1919

20-
fn C.SDL_GetPowerInfo(seconds &int, percent &int) C.SDL_PowerState
20+
fn C.SDL_GetPowerInfo(seconds &int, percent &int) PowerState
2121

2222
// get_power_info gets the current power supply details.
2323
//

sensor.c.v

+6-6
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ pub fn sensor_get_device_name(device_index int) &char {
138138
return C.SDL_SensorGetDeviceName(device_index)
139139
}
140140

141-
fn C.SDL_SensorGetDeviceType(device_index int) C.SDL_SensorType
141+
fn C.SDL_SensorGetDeviceType(device_index int) SensorType
142142

143143
// sensor_get_device_type gets the type of a sensor.
144144
//
@@ -164,7 +164,7 @@ pub fn sensor_get_device_non_portable_type(device_index int) int {
164164
return C.SDL_SensorGetDeviceNonPortableType(device_index)
165165
}
166166

167-
fn C.SDL_SensorGetDeviceInstanceID(device_index int) C.SDL_SensorID
167+
fn C.SDL_SensorGetDeviceInstanceID(device_index int) SensorID
168168

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

191-
fn C.SDL_SensorFromInstanceID(instance_id C.SDL_SensorID) &C.SDL_Sensor
191+
fn C.SDL_SensorFromInstanceID(instance_id SensorID) &Sensor
192192

193193
// sensor_from_instance_id returns the SDL_Sensor associated with an instance id.
194194
//
195195
// `instance_id` The sensor from instance id
196196
// returns an SDL_Sensor object.
197197
//
198198
// NOTE This function is available since SDL 2.0.9.
199-
pub fn sensor_from_instance_id(instance_id C.SDL_SensorID) &Sensor {
199+
pub fn sensor_from_instance_id(instance_id SensorID) &Sensor {
200200
return C.SDL_SensorFromInstanceID(instance_id)
201201
}
202202

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

215-
fn C.SDL_SensorGetType(sensor &C.SDL_Sensor) C.SDL_SensorType
215+
fn C.SDL_SensorGetType(sensor &C.SDL_Sensor) SensorType
216216

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

240-
fn C.SDL_SensorGetInstanceID(sensor &C.SDL_Sensor) C.SDL_SensorID
240+
fn C.SDL_SensorGetInstanceID(sensor &C.SDL_Sensor) SensorID
241241

242242
// sensor_get_instance_id gets the instance ID of a sensor.
243243
//

0 commit comments

Comments
 (0)