#![allow(non_upper_case_globals, non_snake_case)]
use std::ffi::{c_ulong, c_void};
pub type CFOptionFlags = c_ulong;
pub const kCFRunLoopBeforeSources: CFOptionFlags = 1 << 2;
pub const kCFRunLoopBeforeWaiting: CFOptionFlags = 1 << 5;
pub const kCFRunLoopAfterWaiting: CFOptionFlags = 1 << 6;
pub type CFRunLoopObserverCallBack = extern "C" fn(observer: *mut c_void, activity: CFOptionFlags, info: *mut c_void);
pub type CFRunLoopTimerCallBack = extern "C" fn(timer: *mut c_void, info: *mut c_void);
pub type DispatchFunction = extern "C" fn(context: *mut c_void);
#[repr(C)]
pub struct DispatchQueue {
_opaque: [u8; 0],
}
#[link(name = "CoreFoundation", kind = "framework")]
extern "C" {
pub static kCFRunLoopDefaultMode: *const c_void;
pub static kCFRunLoopCommonModes: *const c_void;
pub fn CFRunLoopGetMain() -> *mut c_void;
pub fn CFRunLoopGetCurrent() -> *mut c_void;
pub fn CFRunLoopWakeUp(rl: *mut c_void);
pub fn CFRunLoopPerformBlock(rl: *mut c_void, mode: *const c_void, block: *const c_void);
pub fn CFRunLoopObserverCreate(
allocator: *const c_void,
activities: CFOptionFlags,
repeats: u8,
order: isize,
callout: CFRunLoopObserverCallBack,
context: *mut c_void,
) -> *mut c_void;
pub fn CFRunLoopAddObserver(rl: *mut c_void, observer: *mut c_void, mode: *const c_void);
pub fn CFRunLoopTimerCreate(
allocator: *const c_void,
fire_date: f64,
interval: f64,
flags: CFOptionFlags,
order: isize,
callout: CFRunLoopTimerCallBack,
context: *mut c_void,
) -> *mut c_void;
pub fn CFRunLoopTimerSetTolerance(timer: *mut c_void, tolerance: f64);
pub fn CFRunLoopTimerSetNextFireDate(timer: *mut c_void, fire_date: f64);
pub fn CFRunLoopAddTimer(rl: *mut c_void, timer: *mut c_void, mode: *const c_void);
pub fn CFAbsoluteTimeGetCurrent() -> f64;
}
extern "C" {
pub static _dispatch_main_q: DispatchQueue;
pub fn dispatch_async_f(queue: *const DispatchQueue, context: *mut c_void, work: DispatchFunction);
}
pub fn dispatch_get_main_queue() -> *const DispatchQueue {
std::ptr::addr_of!(_dispatch_main_q)
}