#![warn(missing_docs)]
#![no_std]
pub extern crate ufmt;
pub use ufmt::{uDebug, uDisplay, uWrite, uwrite, uwriteln};
#[cfg(windows)]
extern "system" {
fn SetConsoleOutputCP(wCodePageID: u32) -> i32;
}
pub fn init() {
#[cfg(windows)]
{
unsafe {
SetConsoleOutputCP(65001);
}
}
}
mod imp;
pub use imp::{Stdout, Stderr};
#[macro_export]
macro_rules! println {
() => {
let _ = $crate::ufmt::uwrite!($crate::Stdout::new(), "\n");
};
($($arg:tt)*) => {
let _ = $crate::ufmt::uwriteln!($crate::Stdout::new(), $($arg)*);
};
}
#[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))]
#[macro_export]
macro_rules! print {
($($arg:tt)*) => {
let _ = $crate::ufmt::uwrite!($crate::Stdout::new(), $($arg)*);
};
}
#[macro_export]
macro_rules! eprintln {
() => {
let _ = $crate::ufmt::uwrite!($crate::Stderr::new(), "\n");
};
($($arg:tt)*) => {
let _ = $crate::ufmt::uwriteln!($crate::Stderr::new(), $($arg)*);
};
}
#[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))]
#[macro_export]
macro_rules! eprint {
($($arg:tt)*) => {
let _ = $crate::ufmt::uwrite!($crate::Stderr::new(), $($arg)*);
};
}
#[cfg(debug_assertions)]
#[macro_export]
macro_rules! d_println {
() => {
let _ = $crate::ufmt::uwrite!($crate::Stdout::new(), "\n");
};
($($arg:tt)*) => {
let _ = $crate::ufmt::uwriteln!($crate::Stdout::new(), $($arg)*);
};
}
#[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))]
#[cfg(debug_assertions)]
#[macro_export]
macro_rules! d_print {
($($arg:tt)*) => {
let _ = $crate::ufmt::uwrite!($crate::Stdout::new(), $($arg)*);
};
}
#[cfg(not(debug_assertions))]
#[macro_export]
macro_rules! d_println {
($($arg:tt)*) => {
};
}
#[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))]
#[cfg(not(debug_assertions))]
#[macro_export]
macro_rules! d_print {
($($arg:tt)*) => {
};
}