system.pp 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. unit system;
  2. interface
  3. type
  4. integer = longint;
  5. hresult = integer;
  6. ttypekind = integer;
  7. filerec = integer;
  8. textrec = integer;
  9. pbyte = ^byte;
  10. pchar = ^Char;
  11. procedure fpc_lib_exit; compilerproc;
  12. procedure DebugWrite(const P: PChar);
  13. implementation
  14. type
  15. P__wasi_size_t = ^__wasi_size_t;
  16. __wasi_size_t = longint;
  17. __wasi_fd_t = longint;
  18. size_t = longint;
  19. __wasi_errno_t = longint;
  20. P__wasi_ciovec_t = ^__wasi_ciovec_t;
  21. __wasi_ciovec_t = record
  22. buf: pointer;
  23. buf_len: __wasi_size_t;
  24. end;
  25. function fd_write(fd: __wasi_fd_t;
  26. iovs: P__wasi_ciovec_t;
  27. iovs_len: size_t;
  28. nwritten: P__wasi_size_t): __wasi_errno_t; external 'wasi_unstable';
  29. function StrLen(P: PChar): size_t;
  30. var
  31. i: size_t;
  32. begin
  33. i := 0;
  34. while p[i]<>#0 do
  35. Inc(i);
  36. StrLen := i;
  37. end;
  38. procedure DebugWrite(const P: PChar);
  39. var
  40. our_iov: __wasi_ciovec_t;
  41. our_nwritten: longint;
  42. begin
  43. our_iov.buf := P;
  44. our_iov.buf_len := StrLen(P);
  45. fd_write(1, @our_iov, 1, @our_nwritten);
  46. end;
  47. procedure fpc_lib_exit; compilerproc;
  48. begin
  49. end;
  50. end.