1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
#[macro_export]
macro_rules! dformat {
($fmt:tt $($arg:expr),*) => {
format!(
$crate::dm_arguments!($fmt),
$($arg),*
);
};
}
#[macro_export]
macro_rules! dprintln {
($fmt:tt $($arg:expr),*) => {
println!(
$crate::dm_arguments!($fmt),
$($arg),*
);
};
}
#[macro_export]
macro_rules! dprint {
($fmt:tt $($arg:expr),*) => {
print!(
$crate::dm_arguments!($fmt),
$($arg),*
);
};
}
#[macro_export]
macro_rules! deprintln {
($fmt:tt $($arg:expr),*) => {
eprintln!(
$crate::dm_arguments!($fmt),
$($arg),*
);
};
}
#[macro_export]
macro_rules! deprint {
($fmt:tt $($arg:expr),*) => {
eprint!(
$crate::dm_arguments!($fmt),
$($arg),*
);
};
}
#[macro_export]
macro_rules! dwrite {
($out:expr, $fmt:tt $($arg:expr),*) => {
write!(
$out,
$crate::dm_arguments!($fmt),
$($arg),*
);
};
}
#[macro_export]
macro_rules! dwriteln {
($out:expr, $fmt:tt $($arg:expr),*) => {
writeln!(
$out,
$crate::dm_arguments!($fmt),
$($arg),*
);
};
}
#[macro_export]
macro_rules! dm_arguments {
([$($entry:tt)+]) => {
concat!(
$(deco::dm_entry!($entry)),*
)
};
}
#[macro_export]
macro_rules! dm_entry {
(!) => {
deco::dm_char!(reset)
};
($name:ident) => {
deco::dm_char!($name)
};
($name:literal) => {
$name
}
}
#[macro_export]
macro_rules! dm_char {
($color:ident) => {
concat!("\x1b[", deco::dm_charnum!($color), "m")
}
}
#[macro_export]
macro_rules! dm_charnum {
(reset) => { 0 };
(black) => { 30 };
(red) => { 31 };
(green) => { 32 };
(yellow) => { 33 };
(blue) => { 34 };
(magenta) => { 35 };
(cyan) => { 36 };
(white) => { 37 };
(Black) => { 40 };
(Red) => { 41 };
(Green) => { 42 };
(Yellow) => { 43 };
(Blue) => { 44 };
(Magenta) => { 45 };
(Cyan) => { 46 };
(White) => { 47 };
(on_black) => { 40 };
(on_red) => { 41 };
(on_green) => { 42 };
(on_yellow) => { 43 };
(on_blue) => { 44 };
(on_magenta) => { 45 };
(on_cyan) => { 46 };
(on_white) => { 47 };
(bold) => { 1 };
(italic) => { 3 };
(underscore) => { 4 };
(blink) => { 5 };
(reverse) => { 7 };
(conceal) => { 8 };
}