feat: replace M4 callback writers with safe handles
This commit is contained in:
+5
-3
@@ -1,4 +1,6 @@
|
||||
unit fmt;
|
||||
pub fn write_str(w: &mut io.Writer, s: str) -> !void;
|
||||
pub fn write_int_i32(w: &mut io.Writer, v: i32) -> !void;
|
||||
pub fn write_bool(w: &mut io.Writer, v: bool) -> !void;
|
||||
pub fn fmt_int_i32(buf: []mut u8, v: i32) -> str;
|
||||
pub fn fmt_hex_i32(buf: []mut u8, v: i32) -> str;
|
||||
pub fn fmt_char(buf: []mut u8, v: char) -> str;
|
||||
pub fn fmt_bool(buf: []mut u8, v: bool) -> str;
|
||||
pub fn fmt_error(buf: []mut u8, v: core.Error) -> str;
|
||||
|
||||
+6
-5
@@ -1,9 +1,10 @@
|
||||
unit io;
|
||||
pub struct Writer {
|
||||
ctx: *void,
|
||||
write_fn: fn(*void, []u8) -> !usize,
|
||||
}
|
||||
pub enum Writer { Stdout, Stderr, File(u16), Null }
|
||||
pub enum Reader { Stdin, File(u16) }
|
||||
pub fn write(w: Writer, bytes: []u8) -> !usize;
|
||||
pub fn read(r: Reader, bytes: []mut u8) -> !usize;
|
||||
pub struct File {
|
||||
handle: u16,
|
||||
pub fn close(self: &mut Self) { }
|
||||
pub fn close(self: Self) -> !void;
|
||||
pub fn drop(self: &mut Self) { }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user