2
0

system.pp 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. {
  2. This file is part of the Free Pascal run time library.
  3. Copyright (c) 2007 by contributors of the Free Pascal Compiler
  4. Pascal system unit for the Symbian OS
  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. unit System;
  12. interface
  13. {$ifdef SYSTEMDEBUG}
  14. {$define SYSTEMEXCEPTIONDEBUG}
  15. {$endif SYSTEMDEBUG}
  16. {$ifdef cpui386}
  17. {$define Set_i386_Exception_handler}
  18. {$endif cpui386}
  19. { include system-independent routine headers }
  20. {$I systemh.inc}
  21. const
  22. LineEnding = #13#10;
  23. LFNSupport = true;
  24. DirectorySeparator = '\';
  25. DriveSeparator = ':';
  26. ExtensionSeparator = '.';
  27. PathSeparator = ';';
  28. AllowDirectorySeparators : set of char = ['\','/'];
  29. AllowDriveSeparators : set of char = [':'];
  30. { FileNameCaseSensitive is defined separately below }
  31. maxExitCode = 65535;
  32. MaxPathLen = 260;
  33. AllFilesMask = '*';
  34. type
  35. PEXCEPTION_FRAME = ^TEXCEPTION_FRAME;
  36. TEXCEPTION_FRAME = record
  37. next : PEXCEPTION_FRAME;
  38. handler : pointer;
  39. end;
  40. const
  41. { Default filehandles }
  42. UnusedHandle : THandle = -1;
  43. StdInputHandle : THandle = 0;
  44. StdOutputHandle : THandle = 0;
  45. StdErrorHandle : THandle = 0;
  46. FileNameCaseSensitive : boolean = true;
  47. CtrlZMarksEOF: boolean = true; (* #26 not considered as end of file *)
  48. sLineBreak = LineEnding;
  49. DefaultTextLineBreakStyle : TTextLineBreakStyle = tlbsCRLF;
  50. { Thread count for DLL }
  51. Thread_count : longint = 0;
  52. System_exception_frame : PEXCEPTION_FRAME =nil;
  53. type
  54. TStartupInfo=packed record
  55. cb : longint;
  56. lpReserved : Pointer;
  57. lpDesktop : Pointer;
  58. lpTitle : Pointer;
  59. dwX : longint;
  60. dwY : longint;
  61. dwXSize : longint;
  62. dwYSize : longint;
  63. dwXCountChars : longint;
  64. dwYCountChars : longint;
  65. dwFillAttribute : longint;
  66. dwFlags : longint;
  67. wShowWindow : Word;
  68. cbReserved2 : Word;
  69. lpReserved2 : Pointer;
  70. hStdInput : longint;
  71. hStdOutput : longint;
  72. hStdError : longint;
  73. end;
  74. var
  75. { C compatible arguments }
  76. argc : longint;
  77. argv : ppchar;
  78. { Win32 Info }
  79. startupinfo : tstartupinfo;
  80. hprevinst,
  81. MainInstance,
  82. cmdshow : longint;
  83. DLLreason,DLLparam:longint;
  84. type
  85. TDLL_Process_Entry_Hook = function (dllparam : longint) : longbool;
  86. TDLL_Entry_Hook = procedure (dllparam : longint);
  87. const
  88. Dll_Process_Attach_Hook : TDLL_Process_Entry_Hook = nil;
  89. Dll_Process_Detach_Hook : TDLL_Entry_Hook = nil;
  90. Dll_Thread_Attach_Hook : TDLL_Entry_Hook = nil;
  91. Dll_Thread_Detach_Hook : TDLL_Entry_Hook = nil;
  92. implementation
  93. var
  94. SysInstance: Longint; public name '_FPC_SysInstance';
  95. { include system independent routines }
  96. {$I system.inc}
  97. {*****************************************************************************
  98. Minimum Symbian API declarations
  99. *****************************************************************************}
  100. const KErrNone=0;
  101. {*****************************************************************************
  102. Parameter Handling
  103. *****************************************************************************}
  104. var
  105. ModuleName : array[0..255] of char;
  106. function GetCommandFile:pchar;
  107. begin
  108. end;
  109. procedure setup_arguments;
  110. begin
  111. end;
  112. function paramcount : longint;
  113. begin
  114. paramcount := argc - 1;
  115. end;
  116. function paramstr(l : longint) : string;
  117. begin
  118. if (l>=0) and (l<argc) then
  119. paramstr:=strpas(argv[l])
  120. else
  121. paramstr:='';
  122. end;
  123. procedure randomize;
  124. begin
  125. // randseed:=GetTickCount;
  126. end;
  127. {*****************************************************************************
  128. System Dependent Exit code
  129. *****************************************************************************}
  130. //procedure PascalMain; stdcall; external name 'PASCALMAIN';
  131. //procedure fpc_do_exit; stdcall; external name 'FPC_DO_EXIT';
  132. Procedure system_exit;
  133. begin
  134. end;
  135. var
  136. { value of the stack segment
  137. to check if the call stack can be written on exceptions }
  138. _SS : Cardinal;
  139. procedure pascalmain; external name 'PASCALMAIN';
  140. { Entry point for the pascal code }
  141. function Pascal_E32Main: Integer; cdecl; [public, alias: '_Pascal_E32Main'];
  142. var
  143. ST : pointer;
  144. begin
  145. PascalMain;
  146. { if we pass here there was no error }
  147. system_exit;
  148. Result := KErrNone;
  149. end;
  150. procedure SysInitStdIO;
  151. begin
  152. end;
  153. (* ProcessID cached to avoid repeated calls to GetCurrentProcess. *)
  154. var
  155. ProcessID: SizeUInt;
  156. function GetProcessID: SizeUInt;
  157. begin
  158. GetProcessID := ProcessID;
  159. end;
  160. function CheckInitialStkLen(stklen : SizeUInt) : SizeUInt;
  161. begin
  162. result := stklen;
  163. end;
  164. {
  165. const
  166. Exe_entry_code : pointer = @Exe_entry;
  167. Dll_entry_code : pointer = @Dll_entry;
  168. }
  169. begin
  170. end.