sysutils.pp 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  1. {
  2. This file is part of the Free Pascal run time library.
  3. Copyright (c) 2004 by Karoly Balogh
  4. Sysutils unit for Gameboy Advance.
  5. This unit is based on the MorphOS one and is adapted for Gameboy Advance
  6. simply by stripping out all stuff inside funcs and procs.
  7. Copyright (c) 2006 by Francesco Lombardi
  8. Based on Amiga version by Carl Eric Codere, and other
  9. parts of the RTL
  10. See the file COPYING.FPC, included in this distribution,
  11. for details about the copyright.
  12. This program is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  15. **********************************************************************}
  16. unit sysutils;
  17. interface
  18. {$MODE objfpc}
  19. {$MODESWITCH OUT}
  20. {$IFDEF UNICODERTL}
  21. {$MODESWITCH UNICODESTRINGS}
  22. {$ELSE}
  23. {$H+}
  24. {$ENDIF}
  25. {$modeswitch typehelpers}
  26. {$modeswitch advancedrecords}
  27. {$DEFINE HAS_SLEEP}
  28. {$DEFINE HAS_OSERROR}
  29. { used OS file system APIs use ansistring }
  30. {$define SYSUTILS_HAS_ANSISTR_FILEUTIL_IMPL}
  31. { OS has an ansistring/single byte environment variable API }
  32. {$define SYSUTILS_HAS_ANSISTR_ENVVAR_IMPL}
  33. { Include platform independent interface part }
  34. {$i sysutilh.inc}
  35. implementation
  36. uses
  37. dos, sysconst;
  38. { Include platform independent implementation part }
  39. {$i sysutils.inc}
  40. {****************************************************************************
  41. File Functions
  42. ****************************************************************************}
  43. function FileOpen(const FileName: rawbytestring; Mode: Integer): LongInt;
  44. begin
  45. result := -1;
  46. end;
  47. function FileGetDate(Handle: LongInt) : Int64;
  48. begin
  49. result := -1;
  50. end;
  51. function FileSetDate(Handle: Longint; Age: Int64) : LongInt;
  52. begin
  53. result := -1;
  54. end;
  55. function FileCreate(const FileName: RawByteString) : LongInt;
  56. begin
  57. result := -1;
  58. end;
  59. function FileCreate(const FileName: RawByteString; Rights: integer): LongInt;
  60. begin
  61. result := -1;
  62. end;
  63. function FileCreate(const FileName: RawByteString; ShareMode: integer; rights : integer): LongInt;
  64. begin
  65. result := -1;
  66. end;
  67. function FileRead(Handle: LongInt; Out Buffer; Count: LongInt): LongInt;
  68. begin
  69. result := -1;
  70. end;
  71. function FileWrite(Handle: LongInt; const Buffer; Count: LongInt): LongInt;
  72. begin
  73. result := -1;
  74. end;
  75. function FileSeek(Handle, FOffset, Origin: LongInt) : LongInt;
  76. begin
  77. result := -1;
  78. end;
  79. function FileSeek(Handle: LongInt; FOffset: Int64; Origin: Longint): Int64;
  80. begin
  81. result := -1;
  82. end;
  83. procedure FileClose(Handle: LongInt);
  84. begin
  85. end;
  86. function FileTruncate(Handle: THandle; Size: Int64): Boolean;
  87. begin
  88. result := false;
  89. end;
  90. function DeleteFile(const FileName: RawByteString) : Boolean;
  91. begin
  92. result := false;
  93. end;
  94. function RenameFile(const OldName, NewName: RawByteString): Boolean;
  95. begin
  96. result := false;
  97. end;
  98. (****** end of non portable routines ******)
  99. Function FileAge (Const FileName : RawByteString): Int64;
  100. begin
  101. result := -1;
  102. end;
  103. function FileGetSymLinkTarget(const FileName: RawByteString; out SymLinkRec: TRawbyteSymLinkRec): Boolean;
  104. begin
  105. Result := False;
  106. end;
  107. Function FileExists (Const FileName : RawByteString; FollowLink : Boolean) : Boolean;
  108. Begin
  109. result := false;
  110. end;
  111. Function InternalFindFirst (Const Path : RawByteString; Attr : Longint; out Rslt : TAbstractSearchRec; var Name: RawByteString) : Longint;
  112. begin
  113. result := -1;
  114. end;
  115. Function InternalFindNext (var Rslt : TAbstractSearchRec; var Name : RawByteString) : Longint;
  116. begin
  117. result := -1;
  118. end;
  119. Procedure InternalFindClose(var Handle: THandle);
  120. begin
  121. end;
  122. Function FileGetAttr (Const FileName : RawByteString) : Longint;
  123. begin
  124. result := -1;
  125. end;
  126. Function FileSetAttr (Const Filename : RawByteString; Attr: longint) : Longint;
  127. begin
  128. result := -1;
  129. end;
  130. {****************************************************************************
  131. Disk Functions
  132. ****************************************************************************}
  133. Procedure AddDisk(const path:string);
  134. begin
  135. end;
  136. Function DiskFree(Drive: Byte): int64;
  137. Begin
  138. result := -1;
  139. End;
  140. Function DiskSize(Drive: Byte): int64;
  141. Begin
  142. result := -1;
  143. End;
  144. function DirectoryExists(const Directory: RawByteString; FollowLink : Boolean): Boolean;
  145. begin
  146. result := false;
  147. end;
  148. {****************************************************************************
  149. Misc Functions
  150. ****************************************************************************}
  151. procedure sysBeep;
  152. begin
  153. end;
  154. Procedure Sleep(Milliseconds : Cardinal);
  155. var
  156. i,j : Cardinal;
  157. calib : Cardinal;
  158. begin
  159. {$warning no idea if this calibration value is correct (FK) }
  160. { I estimated it roughly on the CPU clock of 16 MHz and 1+3 clock cycles for the loop }
  161. calib:=4000000;
  162. for i:=1 to Milliseconds do
  163. asm
  164. ldr r0,calib
  165. .L1:
  166. sub r0,r0,#1
  167. bne .L1
  168. end;
  169. end;
  170. Function GetLastOSError : Integer;
  171. begin
  172. Result:=-1;
  173. end;
  174. {****************************************************************************
  175. Locale Functions
  176. ****************************************************************************}
  177. Procedure GetLocalTime(var SystemTime: TSystemTime);
  178. begin
  179. end ;
  180. function SysErrorMessage(ErrorCode: Integer): String;
  181. begin
  182. { Result:=StrError(ErrorCode);}
  183. result := '';
  184. end;
  185. {****************************************************************************
  186. OS utility functions
  187. ****************************************************************************}
  188. Function GetEnvironmentVariable(Const EnvVar : String) : String;
  189. begin
  190. result := '';
  191. end;
  192. Function GetEnvironmentVariableCount : Integer;
  193. begin
  194. result := -1;
  195. end;
  196. Function GetEnvironmentString(Index : Integer) : {$ifdef FPC_RTL_UNICODE}UnicodeString{$else}AnsiString{$endif};
  197. begin
  198. result := '';
  199. end;
  200. function ExecuteProcess (const Path: RawByteString; const ComLine: RawByteString;Flags:TExecuteFlags=[]): integer;
  201. begin
  202. result := -1;
  203. end;
  204. function ExecuteProcess (const Path: RawByteString;
  205. const ComLine: array of RawByteString;Flags:TExecuteFlags=[]): integer;
  206. begin
  207. result := -1;
  208. end;
  209. function ExecuteProcess(const Path: UnicodeString; const ComLine: UnicodeString;
  210. Flags: TExecuteFlags = []): Integer;
  211. begin
  212. { TODO : implement }
  213. result := -1;
  214. end;
  215. function ExecuteProcess(const Path: UnicodeString;
  216. const ComLine: Array of UnicodeString; Flags:TExecuteFlags = []): Integer;
  217. var
  218. CommandLine: UnicodeString;
  219. I: integer;
  220. begin
  221. Commandline := '';
  222. for I := 0 to High (ComLine) do
  223. if Pos (' ', ComLine [I]) <> 0 then
  224. CommandLine := CommandLine + ' ' + '"' + ComLine [I] + '"'
  225. else
  226. CommandLine := CommandLine + ' ' + Comline [I];
  227. ExecuteProcess := ExecuteProcess (Path, CommandLine,Flags);
  228. end;
  229. {****************************************************************************
  230. Initialization code
  231. ****************************************************************************}
  232. Initialization
  233. InitExceptions;
  234. Finalization
  235. FreeTerminateProcs;
  236. DoneExceptions;
  237. end.