Skip to main content

bobcat_console/
lib.rs

1#![no_std]
2
3extern crate alloc;
4
5pub use alloc::format;
6
7pub use bobcat_host::log_txt;
8
9#[macro_export]
10macro_rules! console {
11    ($val:expr) => {
12    {
13        let tmp = $val;
14        let msg = $crate::format!("[{}:{}] {} = {:#?}\n", file!(), line!(), stringify!($val), &tmp);
15        unsafe { $crate::log_txt(msg.as_ptr(), msg.len()) };
16        tmp
17    }};
18    ($($vals:expr),+ $(,)?) => {
19    {
20        let tup = ($($vals),+);
21        let msg = $crate::format!("[{}:{}] {} = {:#?}\n", file!(), line!(), stringify!(($($vals),+)), &tup);
22        unsafe { $crate::log_txt(msg.as_ptr(), msg.len()) };
23        tup
24    }};
25}