parent
e70cac58c8
commit
a3edd38046
@ -0,0 +1,4 @@
|
||||
pub fn translate(id: usize) -> usize {
|
||||
// FIXME: translate syscall id on aarch64
|
||||
id
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
|
||||
pub enum ConsoleColor {
|
||||
Black,
|
||||
Red,
|
||||
Green,
|
||||
Yellow,
|
||||
Blue,
|
||||
Magenta,
|
||||
Cyan,
|
||||
White,
|
||||
BrightBlack,
|
||||
BrightRed,
|
||||
BrightGreen,
|
||||
BrightYellow,
|
||||
BrightBlue,
|
||||
BrightMagenta,
|
||||
BrightCyan,
|
||||
BrightWhite,
|
||||
}
|
||||
|
||||
impl ConsoleColor {
|
||||
pub fn to_console_code(&self) -> u8 {
|
||||
use self::ConsoleColor::*;
|
||||
match self {
|
||||
Black => 30,
|
||||
Red => 31,
|
||||
Green => 32,
|
||||
Yellow => 33,
|
||||
Blue => 34,
|
||||
Magenta => 35,
|
||||
Cyan => 36,
|
||||
White => 37,
|
||||
BrightBlack => 90,
|
||||
BrightRed => 91,
|
||||
BrightGreen => 92,
|
||||
BrightYellow => 93,
|
||||
BrightBlue => 94,
|
||||
BrightMagenta => 95,
|
||||
BrightCyan => 96,
|
||||
BrightWhite => 97,
|
||||
}
|
||||
}
|
||||
pub fn from_console_code(code: u8) -> Option<ConsoleColor> {
|
||||
use self::ConsoleColor::*;
|
||||
match code {
|
||||
30 => Some(Black),
|
||||
31 => Some(Red),
|
||||
32 => Some(Green),
|
||||
33 => Some(Yellow),
|
||||
34 => Some(Blue),
|
||||
35 => Some(Magenta),
|
||||
36 => Some(Cyan),
|
||||
37 => Some(White),
|
||||
90 => Some(BrightBlack),
|
||||
91 => Some(BrightRed),
|
||||
92 => Some(BrightGreen),
|
||||
93 => Some(BrightYellow),
|
||||
94 => Some(BrightBlue),
|
||||
95 => Some(BrightMagenta),
|
||||
96 => Some(BrightCyan),
|
||||
97 => Some(BrightWhite),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
}
|
@ -1,3 +1,6 @@
|
||||
pub mod color;
|
||||
pub mod escape_parser;
|
||||
|
||||
/// Convert C string to Rust string
|
||||
pub unsafe fn from_cstr(s: *const u8) -> &'static str {
|
||||
use core::{str, slice};
|
Loading…
Reference in new issue