+ implemented do_write for WASI. Error handling is not yet done.

git-svn-id: branches/wasm@48299 -
This commit is contained in:
nickysn 2021-01-22 00:15:01 +00:00
parent 9b2e3aa251
commit 5794afac54
2 changed files with 12 additions and 5 deletions

View File

@ -34,8 +34,14 @@ begin
end;
function Do_Write(Handle:thandle;Addr:Pointer;Len:Longint):longint;
var
our_iov: __wasi_ciovec_t;
our_nwritten: longint;
begin
DebugWriteLn('Do_Write');
our_iov.buf := Addr;
our_iov.buf_len := Len;
fd_write(Handle, @our_iov, 1, @our_nwritten);
Do_Write:=our_nwritten;
end;
function Do_Read(Handle:thandle;Addr:Pointer;Len:Longint):Longint;

View File

@ -71,6 +71,11 @@ type
buf_len: __wasi_size_t;
end;
function fd_write(fd: __wasi_fd_t;
iovs: P__wasi_ciovec_t;
iovs_len: size_t;
nwritten: P__wasi_size_t): __wasi_errno_t; external 'wasi_unstable';
{$ifdef FULL_RTL}
{$I system.inc}
@ -127,10 +132,6 @@ begin
end;
{$endif FULL_RTL}
function fd_write(fd: __wasi_fd_t;
iovs: P__wasi_ciovec_t;
iovs_len: size_t;
nwritten: P__wasi_size_t): __wasi_errno_t; external 'wasi_unstable';
procedure DebugWrite(const P: PChar);
var