system.pp 4.9 KB

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