2
0

system.pp 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  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. {$I-,Q-,H-,R-,V-,P+,T+}
  19. {$implicitexceptions off}
  20. {$mode objfpc}
  21. {$modeswitch advancedrecords}
  22. Type
  23. { Java primitive types }
  24. jboolean = boolean;
  25. pjboolean = ^boolean;
  26. jbyte = shortint;
  27. pjbyte = ^jbyte;
  28. jshort = smallint;
  29. pjshort = ^jshort;
  30. jint = longint;
  31. pjint = ^jint;
  32. jlong = int64;
  33. pjlong = ^jlong;
  34. jchar = widechar;
  35. pjchar = ^jchar;
  36. jfloat = single;
  37. pjfloat = ^jfloat;
  38. jdouble = double;
  39. pjdouble = ^jdouble;
  40. Arr1jboolean = array of jboolean;
  41. Arr1jbyte = array of jbyte;
  42. Arr1jshort = array of jshort;
  43. Arr1jint = array of jint;
  44. Arr1jlong = array of jlong;
  45. Arr1jchar = array of jchar;
  46. Arr1jfloat = array of jfloat;
  47. Arr1jdouble = array of jdouble;
  48. Arr2jboolean = array of Arr1jboolean;
  49. Arr2jbyte = array of Arr1jbyte;
  50. Arr2jshort = array of Arr1jshort;
  51. Arr2jint = array of Arr1jint;
  52. Arr2jlong = array of Arr1jlong;
  53. Arr2jchar = array of Arr1jchar;
  54. Arr2jfloat = array of Arr1jfloat;
  55. Arr2jdouble = array of Arr1jdouble;
  56. Arr3jboolean = array of Arr2jboolean;
  57. Arr3jbyte = array of Arr2jbyte;
  58. Arr3jshort = array of Arr2jshort;
  59. Arr3jint = array of Arr2jint;
  60. Arr3jlong = array of Arr2jlong;
  61. Arr3jchar = array of Arr2jchar;
  62. Arr3jfloat = array of Arr2jfloat;
  63. Arr3jdouble = array of Arr2jdouble;
  64. const
  65. maxExitCode = 255;
  66. { Java base class type }
  67. {$ifdef java}
  68. {$define GOTJAVASYSINCLUDE}
  69. {$i java_sysh.inc}
  70. {$i java_sys.inc}
  71. {$endif}
  72. {$ifdef android}
  73. {$define GOTJAVASYSINCLUDE}
  74. {$i java_sysh_android.inc}
  75. {$i java_sys_android.inc}
  76. {$endif}
  77. {$ifndef GOTJAVASYSINCLUDE}
  78. {$error Missing include file with base Java classes}
  79. {$endif}
  80. FpcEnumValueObtainable = interface
  81. function fpcOrdinal: jint;
  82. function fpcGenericValueOf(__fpc_int: longint): JLEnum;
  83. end;
  84. { generic versions are based on FPC/Delphi-style RTTI }
  85. {$define FPC_STR_ENUM_INTERN}
  86. {$i jrech.inc}
  87. {$i jseth.inc}
  88. {$i jpvarh.inc}
  89. {$i jsystemh_types.inc}
  90. {$i jtvarh.inc}
  91. {$i jsstringh.inc}
  92. {$i jdynarrh.inc}
  93. {$i jastringh.inc}
  94. {$i justringh.inc}
  95. {$i jsystemh.inc}
  96. {$i jtconh.inc}
  97. {*****************************************************************************}
  98. implementation
  99. {*****************************************************************************}
  100. function min(a,b : longint) : longint;
  101. begin
  102. if a<=b then
  103. min:=a
  104. else
  105. min:=b;
  106. end;
  107. {$i jtcon.inc}
  108. {$i jtvar.inc}
  109. {$i jsstrings.inc}
  110. {$i jastrings.inc}
  111. {$i justrings.inc}
  112. {$i jrec.inc}
  113. {$i jset.inc}
  114. {$i jpvar.inc}
  115. {$i jdynarr.inc}
  116. {$i jsystem.inc}
  117. {*****************************************************************************
  118. Misc. System Dependent Functions
  119. *****************************************************************************}
  120. procedure System_exit;
  121. begin
  122. JLRuntime.getRuntime.exit(ExitCode);
  123. end;
  124. procedure randomize;
  125. begin
  126. randseed:=JUCalendar.getInstance.getTimeInMillis;
  127. end;
  128. type
  129. CopyOutVarModifiedException = class(JLException)
  130. end;
  131. procedure fpc_var_copyout_mismatch(line,column: longint); compilerproc;
  132. var
  133. linestr,columnstr: unicodestring;
  134. begin
  135. str(line,linestr);
  136. str(column,columnstr);
  137. 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');
  138. end;
  139. {*****************************************************************************
  140. SystemUnit Initialization
  141. *****************************************************************************}
  142. begin
  143. initunicodestringmanager
  144. end.