system.pp 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. unit system;
  2. interface
  3. {$define FPC_IS_SYSTEM}
  4. { The heap for Oric is implemented
  5. in tinyheap.inc include file,
  6. but it uses default SysGetMem names }
  7. {$define HAS_MEMORYMANAGER}
  8. { Use AnsiChar for files }
  9. {$define FPC_ANSI_TEXTFILEREC}
  10. {$define FPC_STDOUT_TRUE_ALIAS}
  11. {$define FPC_STDERR_IS_ALIAS_FOR_STDOUT}
  12. {$I systemh.inc}
  13. {$I tnyheaph.inc}
  14. {$ifndef FPUNONE}
  15. {$ifdef FPC_HAS_FEATURE_SOFTFPU}
  16. {$define fpc_softfpu_interface}
  17. {$i softfpu.pp}
  18. {$undef fpc_softfpu_interface}
  19. {$endif FPC_HAS_FEATURE_SOFTFPU}
  20. {$endif FPUNONE}
  21. var
  22. { Mem[] support }
  23. mem : array[0..$7fff-1] of byte absolute $0;
  24. { memw : array[0..($7fff div sizeof(word))-1] of word absolute $0:$0;
  25. meml : array[0..($7fff div sizeof(longint))-1] of longint absolute $0:$0;}
  26. implementation
  27. const
  28. LineEnding = #13;
  29. { LFNSupport is a variable here, defined below!!! }
  30. DirectorySeparator = '\';
  31. DriveSeparator = ':';
  32. ExtensionSeparator = '.';
  33. PathSeparator = ';';
  34. AllowDirectorySeparators : set of AnsiChar = ['\','/'];
  35. AllowDriveSeparators : set of AnsiChar = [':'];
  36. { FileNameCaseSensitive and FileNameCasePreserving are defined separately below!!! }
  37. maxExitCode = 255;
  38. MaxPathLen = 256;
  39. { Default filehandles }
  40. UnusedHandle = $ffff;{ instead of -1, as it is a word value}
  41. StdInputHandle = 0;
  42. StdOutputHandle = 1;
  43. StdErrorHandle = 2;
  44. FileNameCaseSensitive : boolean = false;
  45. FileNameCasePreserving: boolean = false;
  46. CtrlZMarksEOF: boolean = true; (* #26 is considered as end of file *)
  47. sLineBreak = LineEnding;
  48. DefaultTextLineBreakStyle : TTextLineBreakStyle = tlbsCR;
  49. var
  50. fpc_stackarea_start: word; external name '__fpc_stackarea_start';
  51. fpc_stackarea_end: word; external name '__fpc_stackarea_end';
  52. __heapsize: Word;external name '__heapsize';
  53. __fpc_initialheap: array[0..0] of byte;external name '__fpc_initialheap';
  54. {$I system.inc}
  55. {$I tinyheap.inc}
  56. {$ifndef FPUNONE}
  57. {$ifdef FPC_HAS_FEATURE_SOFTFPU}
  58. {$define fpc_softfpu_implementation}
  59. {$i softfpu.pp}
  60. {$undef fpc_softfpu_implementation}
  61. { we get these functions and types from the softfpu code }
  62. {$define FPC_SYSTEM_HAS_float64}
  63. {$define FPC_SYSTEM_HAS_float32}
  64. {$define FPC_SYSTEM_HAS_flag}
  65. {$define FPC_SYSTEM_HAS_extractFloat64Frac0}
  66. {$define FPC_SYSTEM_HAS_extractFloat64Frac1}
  67. {$define FPC_SYSTEM_HAS_extractFloat64Exp}
  68. {$define FPC_SYSTEM_HAS_extractFloat64Frac}
  69. {$define FPC_SYSTEM_HAS_extractFloat64Sign}
  70. {$define FPC_SYSTEM_HAS_ExtractFloat32Frac}
  71. {$define FPC_SYSTEM_HAS_extractFloat32Exp}
  72. {$define FPC_SYSTEM_HAS_extractFloat32Sign}
  73. {$endif FPC_HAS_FEATURE_SOFTFPU}
  74. {$endif FPUNONE}
  75. procedure randomize;
  76. begin
  77. end;
  78. function GetProcessID: SizeUInt;
  79. begin
  80. GetProcessID:=0;
  81. end;
  82. function CheckInitialStkLen(stklen : SizeUInt) : SizeUInt;
  83. begin
  84. result := stklen;
  85. end;
  86. procedure system_exit;
  87. begin
  88. repeat
  89. until false;
  90. end;
  91. {*****************************************************************************
  92. SystemUnit Initialization
  93. *****************************************************************************}
  94. procedure InitZXHeap;
  95. begin
  96. // RegisterTinyHeapBlock_Simple_Prealigned(@__fpc_initialheap,__heapsize);
  97. end;
  98. procedure SysInitStdIO;
  99. begin
  100. (* OpenStdIO(Input,fmInput,StdInputHandle);
  101. OpenStdIO(Output,fmOutput,StdOutputHandle);
  102. {$ifndef FPC_STDERR_IS_ALIAS_FOR_STDOUT}
  103. OpenStdIO(ErrOutput,fmOutput,StdErrorHandle);
  104. {$endif FPC_STDERR_IS_ALIAS_FOR_STDOUT}
  105. {$ifndef FPC_STDOUT_TRUE_ALIAS}
  106. OpenStdIO(StdOut,fmOutput,StdOutputHandle);
  107. OpenStdIO(StdErr,fmOutput,StdErrorHandle);
  108. {$endif FPC_STDOUT_TRUE_ALIAS}*)
  109. end;
  110. begin
  111. (* StackBottom:=@fpc_stackarea_start;
  112. StackLength:=(@fpc_stackarea_end-@fpc_stackarea_start)+1;
  113. { To be set if this is a GUI or console application }
  114. IsConsole := TRUE;
  115. {$ifdef FPC_HAS_FEATURE_DYNLIBS}
  116. { If dynlibs feature is disabled,
  117. IsLibrary is a constant, which can thus not be set to a value }
  118. { To be set if this is a library and not a program }
  119. IsLibrary := FALSE;
  120. {$endif def FPC_HAS_FEATURE_DYNLIBS}
  121. { Setup heap }
  122. InitZXHeap;
  123. SysInitExceptions;
  124. {$ifdef FPC_HAS_FEATURE_UNICODESTRINGS}
  125. initunicodestringmanager;
  126. {$endif def FPC_HAS_FEATURE_UNICODESTRINGS}
  127. { Setup stdin, stdout and stderr }
  128. SysInitStdIO;
  129. { Reset IO Error }
  130. InOutRes:=0;
  131. {$ifdef FPC_HAS_FEATURE_THREADING}
  132. InitSystemThreads;
  133. {$endif}*)
  134. end.