aboutsummaryrefslogtreecommitdiff
path: root/bunny/src/println.rs
diff options
context:
space:
mode:
Diffstat (limited to 'bunny/src/println.rs')
-rw-r--r--bunny/src/println.rs31
1 files changed, 31 insertions, 0 deletions
diff --git a/bunny/src/println.rs b/bunny/src/println.rs
new file mode 100644
index 0000000..db59e79
--- /dev/null
+++ b/bunny/src/println.rs
@@ -0,0 +1,31 @@
+#[macro_export]
+macro_rules! print {
+ ($($arg:tt)*) => ({
+ use core::fmt::Write;
+ unsafe { (&*::SYSTEM_TABLE.as_ref().unwrap().con_out) }
+ .write_fmt(format_args!($($arg)*))
+ .expect("could not write to console");
+ });
+}
+
+#[macro_export]
+macro_rules! println {
+ ($fmt:expr) => (print!(concat!($fmt, "\r\n")));
+ ($fmt:expr, $($arg:tt)*) => (print!(concat!($fmt, "\r\n"), $($arg)*));
+}
+
+#[macro_export]
+macro_rules! dprint {
+ ($($arg:tt)*) => ({
+ if cfg!(debug_assertions) {
+ print!($($arg)*)
+ }
+ });
+}
+
+#[macro_export]
+macro_rules! dprintln {
+ ($fmt:expr) => (dprint!(concat!($fmt, "\r\n")));
+ ($fmt:expr, $($arg:tt)*) => (dprint!(concat!($fmt, "\r\n"), $($arg)*));
+}
+