mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-13 18:24:19 +02:00
+ implemented do_read for WASI
git-svn-id: branches/wasm@48307 -
This commit is contained in:
parent
f585b2d846
commit
d6038c5709
@ -45,8 +45,14 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function Do_Read(Handle:thandle;Addr:Pointer;Len:Longint):Longint;
|
function Do_Read(Handle:thandle;Addr:Pointer;Len:Longint):Longint;
|
||||||
|
var
|
||||||
|
our_iov: __wasi_iovec_t;
|
||||||
|
our_nread: __wasi_size_t;
|
||||||
begin
|
begin
|
||||||
DebugWriteLn('Do_Read');
|
our_iov.buf:=Addr;
|
||||||
|
our_iov.buf_len:=Len;
|
||||||
|
fd_read(Handle,@our_iov,1,@our_nread);
|
||||||
|
Do_Read:=our_nread;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function Do_FilePos(Handle: thandle):Int64;
|
function Do_FilePos(Handle: thandle):Int64;
|
||||||
|
@ -50,6 +50,12 @@ type
|
|||||||
size_t = longint;
|
size_t = longint;
|
||||||
__wasi_errno_t = longint;
|
__wasi_errno_t = longint;
|
||||||
|
|
||||||
|
P__wasi_iovec_t = ^__wasi_iovec_t;
|
||||||
|
__wasi_iovec_t = record
|
||||||
|
buf: PUInt8;
|
||||||
|
buf_len: __wasi_size_t;
|
||||||
|
end;
|
||||||
|
|
||||||
P__wasi_ciovec_t = ^__wasi_ciovec_t;
|
P__wasi_ciovec_t = ^__wasi_ciovec_t;
|
||||||
__wasi_ciovec_t = record
|
__wasi_ciovec_t = record
|
||||||
buf: pointer;
|
buf: pointer;
|
||||||
@ -62,6 +68,10 @@ function fd_write(fd: __wasi_fd_t;
|
|||||||
iovs: P__wasi_ciovec_t;
|
iovs: P__wasi_ciovec_t;
|
||||||
iovs_len: size_t;
|
iovs_len: size_t;
|
||||||
nwritten: P__wasi_size_t): __wasi_errno_t; external 'wasi_snapshot_preview1';
|
nwritten: P__wasi_size_t): __wasi_errno_t; external 'wasi_snapshot_preview1';
|
||||||
|
function fd_read(fd: __wasi_fd_t;
|
||||||
|
iovs: P__wasi_iovec_t;
|
||||||
|
iovs_len: size_t;
|
||||||
|
nread: P__wasi_size_t): __wasi_errno_t; external 'wasi_snapshot_preview1';
|
||||||
procedure proc_exit(rval: __wasi_exitcode_t); noreturn; external 'wasi_snapshot_preview1';
|
procedure proc_exit(rval: __wasi_exitcode_t); noreturn; external 'wasi_snapshot_preview1';
|
||||||
|
|
||||||
{$I system.inc}
|
{$I system.inc}
|
||||||
|
Loading…
Reference in New Issue
Block a user