From 922bc7f5ae6acfc281fbbee340674db903bb8040 Mon Sep 17 00:00:00 2001 From: Cobrand Date: Wed, 12 Apr 2017 08:26:54 +0200 Subject: [PATCH] sdl2-sys: Add missing SDL_Log_* functions --- sdl2-sys/src/lib.rs | 2 + sdl2-sys/src/log.rs | 200 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 202 insertions(+) create mode 100644 sdl2-sys/src/log.rs diff --git a/sdl2-sys/src/lib.rs b/sdl2-sys/src/lib.rs index bc093957..f798081e 100644 --- a/sdl2-sys/src/lib.rs +++ b/sdl2-sys/src/lib.rs @@ -32,6 +32,7 @@ pub mod sdl; pub mod timer; pub mod version; pub mod hint; +pub mod log; pub use scancode::*; pub use keycode::*; @@ -58,3 +59,4 @@ pub use sdl::*; pub use timer::*; pub use version::*; pub use hint::*; +pub use log::*; diff --git a/sdl2-sys/src/log.rs b/sdl2-sys/src/log.rs new file mode 100644 index 00000000..e2bfdb3a --- /dev/null +++ b/sdl2-sys/src/log.rs @@ -0,0 +1,200 @@ +/* automatically generated by rust-bindgen */ +/* modified and adapted by @Cobrand */ + +pub const SDL_LOG_CATEGORY_APPLICATION: SDL_LOG_CATEGORY = + SDL_LOG_CATEGORY::APPLICATION; +pub const SDL_LOG_CATEGORY_ERROR: SDL_LOG_CATEGORY = + SDL_LOG_CATEGORY::ERROR; +pub const SDL_LOG_CATEGORY_ASSERT: SDL_LOG_CATEGORY = + SDL_LOG_CATEGORY::ASSERT; +pub const SDL_LOG_CATEGORY_SYSTEM: SDL_LOG_CATEGORY = + SDL_LOG_CATEGORY::SYSTEM; +pub const SDL_LOG_CATEGORY_AUDIO: SDL_LOG_CATEGORY = + SDL_LOG_CATEGORY::AUDIO; +pub const SDL_LOG_CATEGORY_VIDEO: SDL_LOG_CATEGORY = + SDL_LOG_CATEGORY::VIDEO; +pub const SDL_LOG_CATEGORY_RENDER: SDL_LOG_CATEGORY = + SDL_LOG_CATEGORY::RENDER; +pub const SDL_LOG_CATEGORY_INPUT: SDL_LOG_CATEGORY = + SDL_LOG_CATEGORY::INPUT; +pub const SDL_LOG_CATEGORY_TEST: SDL_LOG_CATEGORY = + SDL_LOG_CATEGORY::TEST; +pub const SDL_LOG_CATEGORY_RESERVED1: SDL_LOG_CATEGORY = + SDL_LOG_CATEGORY::RESERVED1; +pub const SDL_LOG_CATEGORY_RESERVED2: SDL_LOG_CATEGORY = + SDL_LOG_CATEGORY::RESERVED2; +pub const SDL_LOG_CATEGORY_RESERVED3: SDL_LOG_CATEGORY = + SDL_LOG_CATEGORY::RESERVED3; +pub const SDL_LOG_CATEGORY_RESERVED4: SDL_LOG_CATEGORY = + SDL_LOG_CATEGORY::RESERVED4; +pub const SDL_LOG_CATEGORY_RESERVED5: SDL_LOG_CATEGORY = + SDL_LOG_CATEGORY::RESERVED5; +pub const SDL_LOG_CATEGORY_RESERVED6: SDL_LOG_CATEGORY = + SDL_LOG_CATEGORY::RESERVED6; +pub const SDL_LOG_CATEGORY_RESERVED7: SDL_LOG_CATEGORY = + SDL_LOG_CATEGORY::RESERVED7; +pub const SDL_LOG_CATEGORY_RESERVED8: SDL_LOG_CATEGORY = + SDL_LOG_CATEGORY::RESERVED8; +pub const SDL_LOG_CATEGORY_RESERVED9: SDL_LOG_CATEGORY = + SDL_LOG_CATEGORY::RESERVED9; +pub const SDL_LOG_CATEGORY_RESERVED10: SDL_LOG_CATEGORY = + SDL_LOG_CATEGORY::RESERVED10; +pub const SDL_LOG_CATEGORY_CUSTOM: SDL_LOG_CATEGORY = + SDL_LOG_CATEGORY::CUSTOM; +#[repr(u32)] +/** + * \brief The predefined log categories + * + * By default the application category is enabled at the INFO level, + * the assert category is enabled at the WARN level, test is enabled + * at the VERBOSE level and all other categories are enabled at the + * CRITICAL level. + */ +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub enum SDL_LOG_CATEGORY { + APPLICATION = 0, + ERROR = 1, + ASSERT = 2, + SYSTEM = 3, + AUDIO = 4, + VIDEO = 5, + RENDER = 6, + INPUT = 7, + TEST = 8, + RESERVED1 = 9, + RESERVED2 = 10, + RESERVED3 = 11, + RESERVED4 = 12, + RESERVED5 = 13, + RESERVED6 = 14, + RESERVED7 = 15, + RESERVED8 = 16, + RESERVED9 = 17, + RESERVED10 = 18, + CUSTOM = 19, +} +#[repr(u32)] +/** + * \brief The predefined log priorities + */ +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub enum SDL_LogPriority { + SDL_LOG_PRIORITY_VERBOSE = 1, + SDL_LOG_PRIORITY_DEBUG = 2, + SDL_LOG_PRIORITY_INFO = 3, + SDL_LOG_PRIORITY_WARN = 4, + SDL_LOG_PRIORITY_ERROR = 5, + SDL_LOG_PRIORITY_CRITICAL = 6, + SDL_NUM_LOG_PRIORITIES = 7, +} +extern "C" { + /** + * \brief Set the priority of all log categories + */ + pub fn SDL_LogSetAllPriority(priority: SDL_LogPriority); +} +extern "C" { + /** + * \brief Set the priority of a particular log category + */ + pub fn SDL_LogSetPriority(category: ::std::os::raw::c_int, + priority: SDL_LogPriority); +} +extern "C" { + /** + * \brief Get the priority of a particular log category + */ + pub fn SDL_LogGetPriority(category: ::std::os::raw::c_int) + -> SDL_LogPriority; +} +extern "C" { + /** + * \brief Reset all priorities to default. + * + * \note This is called in SDL_Quit(). + */ + pub fn SDL_LogResetPriorities(); +} +extern "C" { + /** + * \brief Log a message with SDL_LOG_CATEGORY_APPLICATION and SDL_LOG_PRIORITY_INFO + */ + pub fn SDL_Log(fmt: *const ::std::os::raw::c_char, ...); +} +extern "C" { + /** + * \brief Log a message with SDL_LOG_PRIORITY_VERBOSE + */ + pub fn SDL_LogVerbose(category: ::std::os::raw::c_int, + fmt: *const ::std::os::raw::c_char, ...); +} +extern "C" { + /** + * \brief Log a message with SDL_LOG_PRIORITY_DEBUG + */ + pub fn SDL_LogDebug(category: ::std::os::raw::c_int, + fmt: *const ::std::os::raw::c_char, ...); +} +extern "C" { + /** + * \brief Log a message with SDL_LOG_PRIORITY_INFO + */ + pub fn SDL_LogInfo(category: ::std::os::raw::c_int, + fmt: *const ::std::os::raw::c_char, ...); +} +extern "C" { + /** + * \brief Log a message with SDL_LOG_PRIORITY_WARN + */ + pub fn SDL_LogWarn(category: ::std::os::raw::c_int, + fmt: *const ::std::os::raw::c_char, ...); +} +extern "C" { + /** + * \brief Log a message with SDL_LOG_PRIORITY_ERROR + */ + pub fn SDL_LogError(category: ::std::os::raw::c_int, + fmt: *const ::std::os::raw::c_char, ...); +} +extern "C" { + /** + * \brief Log a message with SDL_LOG_PRIORITY_CRITICAL + */ + pub fn SDL_LogCritical(category: ::std::os::raw::c_int, + fmt: *const ::std::os::raw::c_char, ...); +} +extern "C" { + /** + * \brief Log a message with the specified category and priority. + */ + pub fn SDL_LogMessage(category: ::std::os::raw::c_int, + priority: SDL_LogPriority, + fmt: *const ::std::os::raw::c_char, ...); +} +/** + * \brief The prototype for the log output function + */ +pub type SDL_LogOutputFunction = + ::std::option::Option; +extern "C" { + /** + * \brief Get the current log output function. + */ + pub fn SDL_LogGetOutputFunction(callback: *mut SDL_LogOutputFunction, + userdata: + *mut *mut ::std::os::raw::c_void); +} +extern "C" { + /** + * \brief This function allows you to replace the default log output + * function with one of your own. + */ + pub fn SDL_LogSetOutputFunction(callback: SDL_LogOutputFunction, + userdata: *mut ::std::os::raw::c_void); +}