sysutils.pp 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  1. {
  2. This file is part of the Free Pascal run time library.
  3. Copyright (c) 1999-2021 by the Free Pascal development team.
  4. Sysutils unit for The WebAssembly System Interface (WASI).
  5. See the file COPYING.FPC, included in this distribution,
  6. for details about the copyright.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10. **********************************************************************}
  11. {$inline on}
  12. unit sysutils;
  13. interface
  14. {$MODE objfpc}
  15. {$MODESWITCH out}
  16. { force ansistrings }
  17. {$H+}
  18. {$modeswitch typehelpers}
  19. {$modeswitch advancedrecords}
  20. uses
  21. wasiapi;
  22. {$DEFINE HAS_SLEEP}
  23. { used OS file system APIs use ansistring }
  24. {$define SYSUTILS_HAS_ANSISTR_FILEUTIL_IMPL}
  25. { OS has an ansistring/single byte environment variable API }
  26. {$define SYSUTILS_HAS_ANSISTR_ENVVAR_IMPL}
  27. { Include platform independent interface part }
  28. {$i sysutilh.inc}
  29. implementation
  30. uses
  31. sysconst;
  32. {$DEFINE FPC_FEXPAND_UNC} (* UNC paths are supported *)
  33. {$DEFINE FPC_FEXPAND_DRIVES} (* Full paths begin with drive specification *)
  34. {$DEFINE HAS_LOCALTIMEZONEOFFSET}
  35. {$DEFINE executeprocuni} (* Only 1 byte version of ExecuteProcess is provided by the OS *)
  36. { Include platform independent implementation part }
  37. {$i sysutils.inc}
  38. {****************************************************************************
  39. File Functions
  40. ****************************************************************************}
  41. Function FileOpen (Const FileName : RawByteString; Mode : Integer) : THandle;
  42. Begin
  43. end;
  44. Function FileCreate (Const FileName : RawByteString) : THandle;
  45. begin
  46. end;
  47. Function FileCreate (Const FileName : RawByteString; ShareMode:integer; Rights : integer) : THandle;
  48. begin
  49. end;
  50. Function FileCreate (Const FileName : RawByteString; Rights:integer) : THandle;
  51. begin
  52. end;
  53. Function FileRead (Handle : THandle; Out Buffer; Count : longint) : Longint;
  54. begin
  55. end;
  56. Function FileWrite (Handle : THandle; const Buffer; Count : Longint) : Longint;
  57. begin
  58. end;
  59. Function FileSeek (Handle : THandle; FOffset, Origin : Longint) : Longint;
  60. begin
  61. end;
  62. Function FileSeek (Handle : THandle; FOffset: Int64; Origin: {Integer}Longint) : Int64;
  63. begin
  64. end;
  65. Procedure FileClose (Handle : THandle);
  66. begin
  67. end;
  68. Function FileTruncate (Handle: THandle; Size: Int64) : boolean;
  69. begin
  70. end;
  71. Function FileAge (Const FileName : RawByteString): Int64;
  72. begin
  73. end;
  74. function FileGetSymLinkTarget(const FileName: RawByteString; out SymLinkRec: TRawbyteSymLinkRec): Boolean;
  75. begin
  76. Result := False;
  77. end;
  78. function FileExists (const FileName: RawByteString; FollowLink : Boolean): boolean;
  79. begin
  80. end;
  81. Function DirectoryExists (Const Directory : RawByteString; FollowLink : Boolean) : Boolean;
  82. begin
  83. end;
  84. Function InternalFindFirst (Const Path : RawByteString; Attr : Longint; out Rslt : TAbstractSearchRec; var Name: RawByteString) : Longint;
  85. begin
  86. { not yet implemented }
  87. Result := -1;
  88. end;
  89. Function InternalFindNext (var Rslt : TAbstractSearchRec; var Name : RawByteString) : Longint;
  90. begin
  91. { not yet implemented }
  92. Result := -1;
  93. end;
  94. Procedure InternalFindClose(var Handle: THandle);
  95. begin
  96. end;
  97. Function FileGetDate (Handle : THandle) : Int64;
  98. begin
  99. end;
  100. Function FileSetDate (Handle : THandle; Age : Int64) : Longint;
  101. begin
  102. end;
  103. Function FileGetAttr (Const FileName : RawByteString) : Longint;
  104. begin
  105. end;
  106. Function FileSetAttr (Const Filename : RawByteString; Attr: longint) : Longint;
  107. begin
  108. end;
  109. Function DeleteFile (Const FileName : RawByteString) : Boolean;
  110. begin
  111. end;
  112. Function RenameFile (Const OldName, NewName : RawByteString) : Boolean;
  113. begin
  114. end;
  115. {****************************************************************************
  116. Disk Functions
  117. ****************************************************************************}
  118. function diskfree(drive : byte) : int64;
  119. begin
  120. end;
  121. function disksize(drive : byte) : int64;
  122. begin
  123. end;
  124. {****************************************************************************
  125. Time Functions
  126. ****************************************************************************}
  127. {$I tzenv.inc}
  128. Procedure GetLocalTime(var SystemTime: TSystemTime);
  129. begin
  130. end ;
  131. {****************************************************************************
  132. Misc Functions
  133. ****************************************************************************}
  134. procedure sysBeep;
  135. begin
  136. end;
  137. {****************************************************************************
  138. Locale Functions
  139. ****************************************************************************}
  140. procedure InitAnsi;
  141. begin
  142. end;
  143. Procedure InitInternational;
  144. begin
  145. InitInternationalGeneric;
  146. InitAnsi;
  147. end;
  148. function SysErrorMessage(ErrorCode: Integer): String;
  149. begin
  150. Result:=Format(SUnknownErrorCode,[ErrorCode]);
  151. end;
  152. {****************************************************************************
  153. Os utils
  154. ****************************************************************************}
  155. Function GetEnvironmentVariable(Const EnvVar : String) : String;
  156. begin
  157. end;
  158. Function GetEnvironmentVariableCount : Integer;
  159. begin
  160. end;
  161. Function GetEnvironmentString(Index : Integer) : {$ifdef FPC_RTL_UNICODE}UnicodeString{$else}AnsiString{$endif};
  162. begin
  163. end;
  164. function ExecuteProcess(Const Path: RawByteString; Const ComLine: RawByteString;Flags:TExecuteFlags=[]):integer;
  165. begin
  166. end;
  167. function ExecuteProcess (const Path: RawByteString;
  168. const ComLine: array of RawByteString;Flags:TExecuteFlags=[]): integer;
  169. begin
  170. end;
  171. {*************************************************************************
  172. Sleep
  173. *************************************************************************}
  174. procedure Sleep (MilliSeconds: Cardinal);
  175. begin
  176. end;
  177. {****************************************************************************
  178. Initialization code
  179. ****************************************************************************}
  180. Initialization
  181. InitExceptions; { Initialize exceptions. OS independent }
  182. InitInternational; { Initialize internationalization settings }
  183. OnBeep:=@SysBeep;
  184. InitTZ;
  185. Finalization
  186. FreeTerminateProcs;
  187. DoneExceptions;
  188. end.