system.pp 4.8 KB

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