system.pp 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. var
  26. our_iov: __wasi_ciovec_t;
  27. our_nwritten: longint;
  28. function fd_write(fd: __wasi_fd_t;
  29. iovs: P__wasi_ciovec_t;
  30. iovs_len: size_t;
  31. nwritten: P__wasi_size_t): __wasi_errno_t; external 'wasi_unstable';
  32. function StrLen(P: PChar): size_t;
  33. var
  34. lp: pchar;
  35. i: size_t;
  36. begin
  37. lp := p;
  38. i := 0;
  39. while lp[i]<>#0 do
  40. Inc(i);
  41. StrLen := i;
  42. end;
  43. procedure DebugWrite(const P: PChar);
  44. begin
  45. our_iov.buf := P;
  46. our_iov.buf_len := StrLen(P);
  47. fd_write(1, @our_iov, 1, @our_nwritten);
  48. end;
  49. procedure fpc_lib_exit; compilerproc;
  50. begin
  51. end;
  52. end.