diff --git a/msp430-asm/src/lib.rs b/msp430-asm/src/lib.rs index 33b77d4..9c15580 100644 --- a/msp430-asm/src/lib.rs +++ b/msp430-asm/src/lib.rs @@ -1,5 +1,4 @@ //! Helper library for msp430-asm -#![feature(decl_macro)] pub mod split_twice { /// Slices a collection into a beginning, middle, and end, based on two unordered indices pub trait SplitTwice<'t> { @@ -63,30 +62,51 @@ pub mod cursor { use std::fmt::{Arguments, Display}; /// Moves to the {line}th previous line - pub macro previous($line:literal) { - csi!("{}F", $line) + #[macro_export] + macro_rules! previous { + ($line:literal) => { + csi!("{}F", $line) + }; } /// Injects a Command Sequence Introducer - pub macro csi($($t:tt)*) { - format_args!("\x1b[{}", format_args!($($t)*)) + #[macro_export] + macro_rules! csi { + ($($t:tt)*) => { + format_args!("\x1b[{}", format_args!($($t)*)) + }; } /// Formats the args with a foreground [Color] - pub macro fg($fg:expr, $($t:tt)*) { - Colorized::new(Some($fg), None, format_args!($($t)*)) + #[macro_export] + macro_rules! fg { + ($fg:expr, $($t:tt)*) => { + Colorized::new(Some($fg), None, format_args!($($t)*)) + }; } /// Formats the args with a background [Color] - pub macro bg($bg:expr, $(t:tt)*) { - Colorized::new(None, Some($bg), format_args!($($t)*)) + #[macro_export] + macro_rules! bg { + ($bg:expr, $(t:tt)*) => { + Colorized::new(None, Some($bg), format_args!($($t)*)) + }; } /// Formats the args with both a foreground and background [Color] - pub macro color($fg:expr, $bg:expr, $($t:tt)*) { - Colorized::new(Some($fg), Some($bg), format_args!($($t)*)) + #[macro_export] + macro_rules! color { + ($fg:expr, $bg:expr, $($t:tt)*) => { + Colorized::new(Some($fg), Some($bg), format_args!($($t)*)) + } } + pub use bg; + pub use color; + pub use csi; + pub use fg; + pub use previous; + #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] pub enum Color { #[default]