* prefixed all wasi api functions with __wasi_, similar to the C header

git-svn-id: branches/wasm@48353 -
This commit is contained in:
nickysn 2021-01-23 16:29:31 +00:00
parent d5b8f6ac7a
commit 0f50c85b44
4 changed files with 37 additions and 36 deletions

View File

@ -18,7 +18,7 @@ var
res: __wasi_errno_t;
begin
repeat
res:=fd_close(Handle);
res:=__wasi_fd_close(Handle);
until (res=__WASI_ERRNO_SUCCESS) or (res<>__WASI_ERRNO_INTR);
if res=__WASI_ERRNO_SUCCESS then
InOutRes:=0
@ -50,7 +50,7 @@ begin
repeat
our_iov.buf := Addr;
our_iov.buf_len := Len;
res:=fd_write(Handle, @our_iov, 1, @our_nwritten);
res:=__wasi_fd_write(Handle, @our_iov, 1, @our_nwritten);
until (res=__WASI_ERRNO_SUCCESS) or ((res<>__WASI_ERRNO_INTR) and (res<>__WASI_ERRNO_AGAIN));
if res=__WASI_ERRNO_SUCCESS then
begin
@ -73,7 +73,7 @@ begin
repeat
our_iov.buf:=Addr;
our_iov.buf_len:=Len;
fd_read(Handle,@our_iov,1,@our_nread);
__wasi_fd_read(Handle,@our_iov,1,@our_nread);
until (res=__WASI_ERRNO_SUCCESS) or ((res<>__WASI_ERRNO_INTR) and (res<>__WASI_ERRNO_AGAIN));
if res=__WASI_ERRNO_SUCCESS then
begin
@ -176,15 +176,15 @@ Begin
end;
{ real open call }
repeat
res:=path_open(3, { not sure about this fd... }
0,
p,
strlen(p),
oflags,
fs_rights_base,
fs_rights_base,
fdflags,
@ourfd);
res:=__wasi_path_open(3, { not sure about this fd... }
0,
p,
strlen(p),
oflags,
fs_rights_base,
fs_rights_base,
fdflags,
@ourfd);
until (res=__WASI_ERRNO_SUCCESS) or (res<>__WASI_ERRNO_INTR);
{if (res=__WASI_ERRNO_ROFS) and ((OFlags and O_RDWR)<>0) then
begin

View File

@ -60,6 +60,6 @@ function Do_IsDevice(Handle:THandle):boolean;
var
ourfdstat: __wasi_fdstat_t;
begin
fd_fdstat_get(Handle,@ourfdstat);
__wasi_fd_fdstat_get(Handle,@ourfdstat);
Do_IsDevice:=ourfdstat.fs_filetype in [__WASI_FILETYPE_BLOCK_DEVICE,__WASI_FILETYPE_CHARACTER_DEVICE];
end;

View File

@ -77,7 +77,7 @@ End;
procedure System_exit;
begin
proc_exit(ExitCode);
__wasi_proc_exit(ExitCode);
End;
Function ParamCount: Longint;
@ -108,7 +108,7 @@ var
begin
our_iov.buf := PByte(P);
our_iov.buf_len := StrLen(P);
fd_write(1, @our_iov, 1, @our_nwritten);
__wasi_fd_write(1, @our_iov, 1, @our_nwritten);
end;
procedure DebugWriteLn(const P: PChar);

View File

@ -13,24 +13,25 @@
**********************************************************************}
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_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';
function fd_fdstat_get(fd: __wasi_fd_t;
stat: P__wasi_fdstat_t): __wasi_errno_t; external 'wasi_snapshot_preview1';
function path_open(fd: __wasi_fd_t;
dirflags: __wasi_lookupflags_t;
path: PChar;
path_len: size_t;
oflags: __wasi_oflags_t;
fs_rights_base,
fs_rights_inherting: __wasi_rights_t;
fdflags: __wasi_fdflags_t;
opened_fd: P__wasi_fd_t): __wasi_errno_t; external 'wasi_snapshot_preview1';
function fd_close(fd: __wasi_fd_t): __wasi_errno_t; external 'wasi_snapshot_preview1';
function __wasi_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_snapshot_preview1' name 'fd_write';
function __wasi_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' name 'fd_read';
procedure __wasi_proc_exit(rval: __wasi_exitcode_t); noreturn; external 'wasi_snapshot_preview1' name 'proc_exit';
function __wasi_fd_fdstat_get(fd: __wasi_fd_t;
stat: P__wasi_fdstat_t): __wasi_errno_t; external 'wasi_snapshot_preview1' name 'fd_fdstat_get';
function __wasi_path_open(fd: __wasi_fd_t;
dirflags: __wasi_lookupflags_t;
path: PChar;
path_len: size_t;
oflags: __wasi_oflags_t;
fs_rights_base,
fs_rights_inherting: __wasi_rights_t;
fdflags: __wasi_fdflags_t;
opened_fd: P__wasi_fd_t): __wasi_errno_t; external 'wasi_snapshot_preview1' name 'path_open';
function __wasi_fd_close(fd: __wasi_fd_t): __wasi_errno_t; external 'wasi_snapshot_preview1' name 'fd_close';