system.pp 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  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_extractFloat64Sign}
  55. {$define FPC_SYSTEM_HAS_ExtractFloat32Frac}
  56. {$define FPC_SYSTEM_HAS_extractFloat32Exp}
  57. {$define FPC_SYSTEM_HAS_extractFloat32Sign}
  58. {$I system.inc}
  59. {$i ndsbios.inc}
  60. function GetProcessID: SizeUInt;
  61. begin
  62. end;
  63. {*****************************************************************************
  64. Misc. System Dependent Functions
  65. *****************************************************************************}
  66. procedure System_exit;
  67. begin
  68. end;
  69. {*****************************************************************************
  70. ParamStr/Randomize
  71. *****************************************************************************}
  72. { number of args }
  73. function paramcount : longint;
  74. begin
  75. paramcount:=0;
  76. end;
  77. { argument number l }
  78. function paramstr(l : longint) : string;
  79. begin
  80. paramstr:='';
  81. end;
  82. { set randseed to a new pseudo random value }
  83. procedure randomize;
  84. begin
  85. end;
  86. procedure SysInitStdIO;
  87. begin
  88. OpenStdIO(Input,fmInput,StdInputHandle);
  89. OpenStdIO(Output,fmOutput,StdOutputHandle);
  90. OpenStdIO(StdOut,fmOutput,StdOutputHandle);
  91. end;
  92. function CheckInitialStkLen(stklen : SizeUInt) : SizeUInt;
  93. begin
  94. result := stklen;
  95. end;
  96. procedure InitHeap;
  97. begin
  98. {
  99. FillChar(freelists_fixed,sizeof(tfreelists),0);
  100. FillChar(freelists_free_chunk,sizeof(freelists_free_chunk),0);
  101. freelist_var:=nil;
  102. freeoslistcount:=1;
  103. freeoslist:=pointer($2040000);
  104. fillchar(freeoslist^,sizeof(freeoslist^),0);
  105. freeoslist^.size:=$40000;
  106. fillchar(internal_status,sizeof(internal_status),0);
  107. }
  108. end;
  109. begin
  110. StackLength := CheckInitialStkLen(InitialStkLen);
  111. ///StackBottom := Sptr - StackLength;
  112. StackBottom := StackTop - StackLength;
  113. { OS specific startup }
  114. fake_heap_start := pchar(0);
  115. fake_heap_end := pchar(0);
  116. { Set up signals handlers }
  117. { Setup heap }
  118. InitHeap;
  119. //SysInitExceptions;
  120. { Setup stdin, stdout and stderr }
  121. //SysInitStdIO;
  122. { Reset IO Error }
  123. InOutRes := 0;
  124. { Arguments }
  125. //InitSystemThreads;
  126. //initvariantmanager;
  127. //initwidestringmanager;
  128. end.