system.pp 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. unit system;
  2. interface
  3. {$define FPC_IS_SYSTEM}
  4. {$DEFINE FPCRTL_FILESYSTEM_SINGLE_BYTE_API}
  5. {$I systemh.inc}
  6. {$ifndef FPUNONE}
  7. {$ifdef FPC_HAS_FEATURE_SOFTFPU}
  8. {$define fpc_softfpu_interface}
  9. {$i softfpu.pp}
  10. {$undef fpc_softfpu_interface}
  11. {$endif FPC_HAS_FEATURE_SOFTFPU}
  12. {$endif FPUNONE}
  13. const
  14. maxExitCode = 255;
  15. AllowDirectorySeparators : set of AnsiChar = ['\','/'];
  16. DirectorySeparator = '/';
  17. { Default filehandles }
  18. UnusedHandle = $ffff;{ instead of -1, as it is a word value}
  19. StdInputHandle = 0;
  20. StdOutputHandle = 1;
  21. StdErrorHandle = 2;
  22. CtrlZMarksEOF: boolean = true; (* #26 is considered as end of file *)
  23. DefaultTextLineBreakStyle : TTextLineBreakStyle = tlbsCR;
  24. LineEnding = #10;
  25. PathSeparator = '/';
  26. MaxPathLen = 255;
  27. LFNSupport = true;
  28. FileNameCaseSensitive = true;
  29. sLineBreak = #13;
  30. var
  31. argc:longint=0;
  32. argv:PPAnsiChar;
  33. envp:PPAnsiChar;
  34. implementation
  35. var
  36. StkLen: SizeUInt; external name '__stklen';
  37. bss_end: record end; external name '__bss_end__';
  38. procedure _InitHeap(p: pdword; l: dword); external name 'InitHeap2';
  39. procedure _free(p: pointer); external name 'free2';
  40. function _malloc(l: dword): pointer; external name 'malloc2';
  41. {I ../mips/setjump.inc}
  42. {$I system.inc}
  43. {$ifndef FPUNONE}
  44. {$ifdef FPC_HAS_FEATURE_SOFTFPU}
  45. {$define fpc_softfpu_implementation}
  46. {$i softfpu.pp}
  47. {$undef fpc_softfpu_implementation}
  48. { we get these functions and types from the softfpu code }
  49. {$define FPC_SYSTEM_HAS_float64}
  50. {$define FPC_SYSTEM_HAS_float32}
  51. {$define FPC_SYSTEM_HAS_flag}
  52. {$define FPC_SYSTEM_HAS_extractFloat64Frac0}
  53. {$define FPC_SYSTEM_HAS_extractFloat64Frac1}
  54. {$define FPC_SYSTEM_HAS_extractFloat64Exp}
  55. {$define FPC_SYSTEM_HAS_extractFloat64Frac}
  56. {$define FPC_SYSTEM_HAS_extractFloat64Sign}
  57. {$define FPC_SYSTEM_HAS_ExtractFloat32Frac}
  58. {$define FPC_SYSTEM_HAS_extractFloat32Exp}
  59. {$define FPC_SYSTEM_HAS_extractFloat32Sign}
  60. {$endif FPC_HAS_FEATURE_SOFTFPU}
  61. {$endif FPUNONE}
  62. procedure Randomize;
  63. begin
  64. randseed:= 1234;
  65. end;
  66. function GetProcessID: LongWord;
  67. begin
  68. result:= 0;
  69. end;
  70. function ParamCount: LongInt;
  71. begin
  72. ParamCount:= 0;
  73. end;
  74. function ParamStr(l: LongInt): ShortString;
  75. begin
  76. result:='';
  77. end;
  78. procedure SysInitStdIO;
  79. begin
  80. end;
  81. function CheckInitialStkLen(stklen : SizeUInt) : SizeUInt;
  82. begin
  83. result:= stklen;
  84. end;
  85. procedure system_exit;
  86. begin
  87. repeat
  88. until false;
  89. end;
  90. begin
  91. StackLength:=CheckInitialStkLen(stklen);
  92. StackBottom:=Pointer(PtrUInt($80200000)-PtrUInt(StackLength));
  93. { Setup heap }
  94. _InitHeap(pdword(@bss_end),PtrUInt(StackBottom)-PtrUInt(@bss_end));
  95. InitHeap;
  96. { Init exceptions }
  97. SysInitExceptions;
  98. { Init unicode strings }
  99. initunicodestringmanager;
  100. InOutRes:= 0;
  101. end.