diff options
Diffstat (limited to 'ctr-std/src/io/print.rs')
| -rw-r--r-- | ctr-std/src/io/print.rs | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/ctr-std/src/io/print.rs b/ctr-std/src/io/print.rs deleted file mode 100644 index 8a5851b..0000000 --- a/ctr-std/src/io/print.rs +++ /dev/null @@ -1,33 +0,0 @@ -use fmt; -use io::{self, Write}; - -// NOTE: We're just gonna use the spin mutex until we figure out how to properly -// implement mutexes with ctrulib functions -use spin::Mutex; -use libc; - -pub static STDOUT: Mutex<StdoutRaw> = Mutex::new(StdoutRaw(())); - -pub struct StdoutRaw(()); - -#[stable(feature = "3ds", since = "1.0.0")] -impl Write for StdoutRaw { - fn write(&mut self, buf: &[u8]) -> io::Result<usize> { - unsafe { - // devkitPro's version of write(2) fails if zero bytes are written, - // so let's just exit if the buffer size is zero - if buf.is_empty() { - return Ok(buf.len()) - } - libc::write(libc::STDOUT_FILENO, buf.as_ptr() as *const _, buf.len()); - Ok(buf.len()) - } - } - - fn flush(&mut self) -> io::Result<()> { Ok(()) } -} - -#[doc(hidden)] -pub fn _print(args: fmt::Arguments) { - STDOUT.lock().write_fmt(args).unwrap(); -} |