system.pp 4.8 KB

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