system.pp 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. {
  2. This file is part of the Free Pascal run time library.
  3. Copyright (c) 2006 by Florian Klaempfl
  4. member of the Free Pascal development team.
  5. System unit for embedded systems
  6. See the file COPYING.FPC, included in this distribution,
  7. for details about the copyright.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. **********************************************************************}
  12. Unit System;
  13. {$namespace org.freepascal.rtl}
  14. {*****************************************************************************}
  15. interface
  16. {*****************************************************************************}
  17. {$define FPC_IS_SYSTEM}
  18. {$define FPC_HAS_FEATURE_TEXTIO}
  19. {$I-,Q-,H-,R-,V-,P+,T+}
  20. {$implicitexceptions off}
  21. {$mode objfpc}
  22. {$modeswitch advancedrecords}
  23. Type
  24. { Java primitive types }
  25. jboolean = boolean;
  26. pjboolean = ^boolean;
  27. jbyte = shortint;
  28. pjbyte = ^jbyte;
  29. jshort = smallint;
  30. pjshort = ^jshort;
  31. jint = longint;
  32. pjint = ^jint;
  33. jlong = int64;
  34. pjlong = ^jlong;
  35. jchar = widechar;
  36. pjchar = ^jchar;
  37. jfloat = single;
  38. pjfloat = ^jfloat;
  39. jdouble = double;
  40. pjdouble = ^jdouble;
  41. Arr1jboolean = array of jboolean;
  42. Arr1jbyte = array of jbyte;
  43. Arr1jshort = array of jshort;
  44. Arr1jint = array of jint;
  45. Arr1jlong = array of jlong;
  46. Arr1jchar = array of jchar;
  47. Arr1jfloat = array of jfloat;
  48. Arr1jdouble = array of jdouble;
  49. Arr2jboolean = array of Arr1jboolean;
  50. Arr2jbyte = array of Arr1jbyte;
  51. Arr2jshort = array of Arr1jshort;
  52. Arr2jint = array of Arr1jint;
  53. Arr2jlong = array of Arr1jlong;
  54. Arr2jchar = array of Arr1jchar;
  55. Arr2jfloat = array of Arr1jfloat;
  56. Arr2jdouble = array of Arr1jdouble;
  57. Arr3jboolean = array of Arr2jboolean;
  58. Arr3jbyte = array of Arr2jbyte;
  59. Arr3jshort = array of Arr2jshort;
  60. Arr3jint = array of Arr2jint;
  61. Arr3jlong = array of Arr2jlong;
  62. Arr3jchar = array of Arr2jchar;
  63. Arr3jfloat = array of Arr2jfloat;
  64. Arr3jdouble = array of Arr2jdouble;
  65. const
  66. maxExitCode = 255;
  67. { Java base class type }
  68. {$ifdef java}
  69. {$define GOTJAVASYSINCLUDE}
  70. {$i java_sysh.inc}
  71. {$i java_sys.inc}
  72. {$endif}
  73. {$ifdef android}
  74. {$define GOTJAVASYSINCLUDE}
  75. {$i java_sysh_android.inc}
  76. {$i java_sys_android.inc}
  77. {$endif}
  78. {$ifndef GOTJAVASYSINCLUDE}
  79. {$error Missing include file with base Java classes}
  80. {$endif}
  81. FpcEnumValueObtainable = interface
  82. function fpcOrdinal: jint;
  83. function fpcGenericValueOf(__fpc_int: longint): JLEnum;
  84. end;
  85. { generic versions are based on FPC/Delphi-style RTTI }
  86. {$define FPC_STR_ENUM_INTERN}
  87. {$i jrech.inc}
  88. {$i jseth.inc}
  89. {$i jpvarh.inc}
  90. {$i jsystemh_types.inc}
  91. {$i jtvarh.inc}
  92. {$i jsstringh.inc}
  93. {$i jdynarrh.inc}
  94. {$i jastringh.inc}
  95. {$i justringh.inc}
  96. Type
  97. THandle = JLObject;
  98. {$i textrec.inc}
  99. PText = ^TextRec;
  100. Var
  101. { Standard In- and Output }
  102. ErrOutput,
  103. Output,
  104. Input,
  105. StdOut,
  106. StdErr : Text;
  107. InOutRes : Word;
  108. {$i jsystemh.inc}
  109. {$i jtconh.inc}
  110. {*****************************************************************************}
  111. implementation
  112. {*****************************************************************************}
  113. function min(a,b : longint) : longint;
  114. begin
  115. if a<=b then
  116. min:=a
  117. else
  118. min:=b;
  119. end;
  120. {$i jtcon.inc}
  121. {$i jtvar.inc}
  122. {$i jsstrings.inc}
  123. {$i jastrings.inc}
  124. {$i justrings.inc}
  125. {$i jrec.inc}
  126. {$i jset.inc}
  127. {$i jpvar.inc}
  128. {$i jdynarr.inc}
  129. {$i sysfile.inc}
  130. {$i jsystem.inc}
  131. {*****************************************************************************
  132. Misc. System Dependent Functions
  133. *****************************************************************************}
  134. procedure System_exit;
  135. begin
  136. JLRuntime.getRuntime.exit(ExitCode);
  137. end;
  138. procedure randomize;
  139. begin
  140. randseed:=JUCalendar.getInstance.getTimeInMillis;
  141. end;
  142. type
  143. CopyOutVarModifiedException = class(JLException)
  144. end;
  145. procedure fpc_var_copyout_mismatch(line,column: longint); compilerproc;
  146. var
  147. linestr,columnstr: unicodestring;
  148. begin
  149. str(line,linestr);
  150. str(column,columnstr);
  151. raise CopyOutVarModifiedException.create('Var parameter ending at line '+linestr+' column '+columnstr+' in the previous stack frame has been modified to a different value than the returned copyback value');
  152. end;
  153. {*****************************************************************************
  154. SystemUnit Initialization
  155. *****************************************************************************}
  156. begin
  157. initunicodestringmanager
  158. end.