sysutils.pp 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  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. { force ansistrings }
  21. {$H+}
  22. {$DEFINE HAS_SLEEP}
  23. {$DEFINE HAS_OSERROR}
  24. { Include platform independent interface part }
  25. {$i sysutilh.inc}
  26. implementation
  27. uses
  28. dos, sysconst;
  29. { used OS file system APIs use ansistring }
  30. {$define SYSUTILS_HAS_ANSISTR_FILEUTIL_IMPL}
  31. { Include platform independent implementation part }
  32. {$i sysutils.inc}
  33. {****************************************************************************
  34. File Functions
  35. ****************************************************************************}
  36. function FileOpen(const FileName: rawbytestring; Mode: Integer): LongInt;
  37. begin
  38. result := -1;
  39. end;
  40. function FileGetDate(Handle: LongInt) : LongInt;
  41. begin
  42. result := -1;
  43. end;
  44. function FileSetDate(Handle, Age: LongInt) : LongInt;
  45. begin
  46. result := -1;
  47. end;
  48. function FileCreate(const FileName: RawByteString) : LongInt;
  49. begin
  50. result := -1;
  51. end;
  52. function FileCreate(const FileName: RawByteString; Rights: integer): LongInt;
  53. begin
  54. result := -1;
  55. end;
  56. function FileCreate(const FileName: RawByteString; ShareMode: integer; rights : integer): LongInt;
  57. begin
  58. result := -1;
  59. end;
  60. function FileRead(Handle: LongInt; Out Buffer; Count: LongInt): LongInt;
  61. begin
  62. result := -1;
  63. end;
  64. function FileWrite(Handle: LongInt; const Buffer; Count: LongInt): LongInt;
  65. begin
  66. result := -1;
  67. end;
  68. function FileSeek(Handle, FOffset, Origin: LongInt) : LongInt;
  69. begin
  70. result := -1;
  71. end;
  72. function FileSeek(Handle: LongInt; FOffset: Int64; Origin: Longint): Int64;
  73. begin
  74. result := -1;
  75. end;
  76. procedure FileClose(Handle: LongInt);
  77. begin
  78. end;
  79. function FileTruncate(Handle: THandle; Size: Int64): Boolean;
  80. begin
  81. result := false;
  82. end;
  83. function DeleteFile(const FileName: RawByteString) : Boolean;
  84. begin
  85. result := false;
  86. end;
  87. function RenameFile(const OldName, NewName: RawByteString): Boolean;
  88. begin
  89. result := false;
  90. end;
  91. (****** end of non portable routines ******)
  92. Function FileAge (Const FileName : String): Longint;
  93. begin
  94. result := -1;
  95. end;
  96. Function FileExists (Const FileName : RawByteString) : Boolean;
  97. Begin
  98. result := false;
  99. end;
  100. Function FindFirst (Const Path : String; Attr : Longint; Out Rslt : TSearchRec) : Longint;
  101. begin
  102. result := -1;
  103. end;
  104. Function FindNext (Var Rslt : TSearchRec) : Longint;
  105. begin
  106. result := -1;
  107. end;
  108. Procedure FindClose (Var F : TSearchrec);
  109. begin
  110. end;
  111. Function FileGetAttr (Const FileName : RawByteString) : Longint;
  112. begin
  113. result := -1;
  114. end;
  115. Function FileSetAttr (Const Filename : RawByteString; Attr: longint) : Longint;
  116. begin
  117. result := -1;
  118. end;
  119. {****************************************************************************
  120. Disk Functions
  121. ****************************************************************************}
  122. Procedure AddDisk(const path:string);
  123. begin
  124. end;
  125. Function DiskFree(Drive: Byte): int64;
  126. Begin
  127. result := -1;
  128. End;
  129. Function DiskSize(Drive: Byte): int64;
  130. Begin
  131. result := -1;
  132. End;
  133. Function GetCurrentDir : String;
  134. begin
  135. result := '';
  136. end;
  137. Function SetCurrentDir (Const NewDir : String) : Boolean;
  138. begin
  139. result := false;
  140. end;
  141. Function CreateDir (Const NewDir : String) : Boolean;
  142. begin
  143. result := false;
  144. end;
  145. Function RemoveDir (Const Dir : String) : Boolean;
  146. begin
  147. result := false;
  148. end;
  149. function DirectoryExists(const Directory: RawByteString): Boolean;
  150. begin
  151. result := false;
  152. end;
  153. {****************************************************************************
  154. Misc Functions
  155. ****************************************************************************}
  156. procedure sysBeep;
  157. begin
  158. end;
  159. Procedure Sleep(Milliseconds : Cardinal);
  160. var
  161. i,j : Cardinal;
  162. calib : Cardinal;
  163. begin
  164. {$warning no idea if this calibration value is correct (FK) }
  165. { I estimated it roughly on the CPU clock of 16 MHz and 1+3 clock cycles for the loop }
  166. calib:=4000000;
  167. for i:=1 to Milliseconds do
  168. asm
  169. ldr r0,calib
  170. .L1:
  171. sub r0,r0,#1
  172. bne .L1
  173. end;
  174. end;
  175. Function GetLastOSError : Integer;
  176. begin
  177. Result:=-1;
  178. end;
  179. {****************************************************************************
  180. Locale Functions
  181. ****************************************************************************}
  182. Procedure GetLocalTime(var SystemTime: TSystemTime);
  183. begin
  184. end ;
  185. function SysErrorMessage(ErrorCode: Integer): String;
  186. begin
  187. { Result:=StrError(ErrorCode);}
  188. result := '';
  189. end;
  190. {****************************************************************************
  191. OS utility functions
  192. ****************************************************************************}
  193. Function GetEnvironmentVariable(Const EnvVar : String) : String;
  194. begin
  195. result := '';
  196. end;
  197. Function GetEnvironmentVariableCount : Integer;
  198. begin
  199. result := -1;
  200. end;
  201. Function GetEnvironmentString(Index : Integer) : String;
  202. begin
  203. result := '';
  204. end;
  205. function ExecuteProcess (const Path: AnsiString; const ComLine: AnsiString;Flags:TExecuteFlags=[]): integer;
  206. begin
  207. result := -1;
  208. end;
  209. function ExecuteProcess (const Path: AnsiString;
  210. const ComLine: array of AnsiString;Flags:TExecuteFlags=[]): integer;
  211. begin
  212. result := -1;
  213. end;
  214. {****************************************************************************
  215. Initialization code
  216. ****************************************************************************}
  217. Initialization
  218. InitExceptions;
  219. Finalization
  220. DoneExceptions;
  221. end.