2
0

system.pp 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. {
  2. This file is part of the Free Pascal run time library.
  3. Copyright (c) 2006 by Francesco Lombardi.
  4. System unit for Nintendo DS
  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. {$define FPC_IS_SYSTEM}
  14. {$i ndsbiosh.inc}
  15. {$I systemh.inc}
  16. {$define fpc_softfpu_interface}
  17. {$i softfpu.pp}
  18. {$undef fpc_softfpu_interface}
  19. const
  20. LineEnding = #10;
  21. LFNSupport = true;
  22. CtrlZMarksEOF: boolean = false;
  23. DirectorySeparator = '/';
  24. DriveSeparator = ':';
  25. PathSeparator = ';';
  26. FileNameCaseSensitive = false;
  27. maxExitCode = 255;
  28. MaxPathLen = 255;
  29. sLineBreak : string[1] = LineEnding;
  30. DefaultTextLineBreakStyle : TTextLineBreakStyle = tlbsCRLF;
  31. const
  32. UnusedHandle = $ffff;
  33. StdInputHandle = 0;
  34. StdOutputHandle = 1;
  35. StdErrorHandle = $ffff;
  36. var
  37. argc: LongInt = 0;
  38. argv: PPChar;
  39. envp: PPChar;
  40. errno: integer;
  41. fake_heap_start: pchar; cvar;
  42. fake_heap_end: pchar; cvar;
  43. implementation
  44. {$define fpc_softfpu_implementation}
  45. {$i softfpu.pp}
  46. {$undef fpc_softfpu_implementation}
  47. { we get these functions and types from the softfpu code }
  48. {$define FPC_SYSTEM_HAS_float64}
  49. {$define FPC_SYSTEM_HAS_float32}
  50. {$define FPC_SYSTEM_HAS_flag}
  51. {$define FPC_SYSTEM_HAS_extractFloat64Frac0}
  52. {$define FPC_SYSTEM_HAS_extractFloat64Frac1}
  53. {$define FPC_SYSTEM_HAS_extractFloat64Exp}
  54. {$define FPC_SYSTEM_HAS_extractFloat64Frac}
  55. {$define FPC_SYSTEM_HAS_extractFloat64Sign}
  56. {$define FPC_SYSTEM_HAS_ExtractFloat32Frac}
  57. {$define FPC_SYSTEM_HAS_extractFloat32Exp}
  58. {$define FPC_SYSTEM_HAS_extractFloat32Sign}
  59. {$I system.inc}
  60. {$i ndsbios.inc}
  61. function GetProcessID: SizeUInt;
  62. begin
  63. end;
  64. {*****************************************************************************
  65. Misc. System Dependent Functions
  66. *****************************************************************************}
  67. procedure System_exit;
  68. begin
  69. end;
  70. {*****************************************************************************
  71. ParamStr/Randomize
  72. *****************************************************************************}
  73. { number of args }
  74. function paramcount : longint;
  75. begin
  76. paramcount:=0;
  77. end;
  78. { argument number l }
  79. function paramstr(l : longint) : string;
  80. begin
  81. paramstr:='';
  82. end;
  83. { set randseed to a new pseudo random value }
  84. procedure randomize;
  85. begin
  86. end;
  87. procedure SysInitStdIO;
  88. begin
  89. OpenStdIO(Input,fmInput,StdInputHandle);
  90. OpenStdIO(Output,fmOutput,StdOutputHandle);
  91. OpenStdIO(StdOut,fmOutput,StdOutputHandle);
  92. end;
  93. function CheckInitialStkLen(stklen : SizeUInt) : SizeUInt;
  94. begin
  95. result := stklen;
  96. end;
  97. procedure InitHeap;
  98. begin
  99. {
  100. FillChar(freelists_fixed,sizeof(tfreelists),0);
  101. FillChar(freelists_free_chunk,sizeof(freelists_free_chunk),0);
  102. freelist_var:=nil;
  103. freeoslistcount:=1;
  104. freeoslist:=pointer($2040000);
  105. fillchar(freeoslist^,sizeof(freeoslist^),0);
  106. freeoslist^.size:=$40000;
  107. fillchar(internal_status,sizeof(internal_status),0);
  108. }
  109. end;
  110. begin
  111. StackLength := CheckInitialStkLen(InitialStkLen);
  112. ///StackBottom := Sptr - StackLength;
  113. StackBottom := StackTop - StackLength;
  114. { OS specific startup }
  115. fake_heap_start := pchar(0);
  116. fake_heap_end := pchar(0);
  117. { Set up signals handlers }
  118. { Setup heap }
  119. InitHeap;
  120. //SysInitExceptions;
  121. { Setup stdin, stdout and stderr }
  122. //SysInitStdIO;
  123. { Reset IO Error }
  124. InOutRes := 0;
  125. { Arguments }
  126. //InitSystemThreads;
  127. //initvariantmanager;
  128. //initwidestringmanager;
  129. end.