mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 23:28:48 +00:00
Fix fmt implementation for js
This commit is contained in:
+10
-13
@@ -11,27 +11,24 @@ foreign odin_env {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@(private="file")
|
@(private="file")
|
||||||
write_vtable := io.Stream_VTable{
|
write_stream_proc :: proc(stream_data: rawptr, mode: io.Stream_Mode, p: []byte, offset: i64, whence: io.Seek_From) -> (n: i64, err: io.Error) {
|
||||||
impl_write = proc(s: io.Stream, p: []byte) -> (n: int, err: io.Error) {
|
if mode == .Write {
|
||||||
fd := u32(uintptr(s.stream_data))
|
fd := u32(uintptr(stream_data))
|
||||||
write(fd, p)
|
write(fd, p)
|
||||||
return len(p), nil
|
return i64(len(p)), nil
|
||||||
},
|
}
|
||||||
|
return 0, .Empty
|
||||||
}
|
}
|
||||||
|
|
||||||
@(private="file")
|
@(private="file")
|
||||||
stdout := io.Writer{
|
stdout := io.Writer{
|
||||||
stream = {
|
procedure = write_stream_proc,
|
||||||
stream_vtable = &write_vtable,
|
data = rawptr(uintptr(1)),
|
||||||
stream_data = rawptr(uintptr(1)),
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
@(private="file")
|
@(private="file")
|
||||||
stderr := io.Writer{
|
stderr := io.Writer{
|
||||||
stream = {
|
procedure = write_stream_proc,
|
||||||
stream_vtable = &write_vtable,
|
data = rawptr(uintptr(2)),
|
||||||
stream_data = rawptr(uintptr(2)),
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// print formats using the default print settings and writes to stdout
|
// print formats using the default print settings and writes to stdout
|
||||||
|
|||||||
Reference in New Issue
Block a user