system.pp 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  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. jbyte = shortint;
  26. jshort = smallint;
  27. jint = longint;
  28. jlong = int64;
  29. jchar = widechar;
  30. jfloat = single;
  31. jdouble = double;
  32. Arr1jboolean = array of jboolean;
  33. Arr1jbyte = array of jbyte;
  34. Arr1jshort = array of jshort;
  35. Arr1jint = array of jint;
  36. Arr1jlong = array of jlong;
  37. Arr1jchar = array of jchar;
  38. Arr1jfloat = array of jfloat;
  39. Arr1jdouble = array of jdouble;
  40. Arr2jboolean = array of Arr1jboolean;
  41. Arr2jbyte = array of Arr1jbyte;
  42. Arr2jshort = array of Arr1jshort;
  43. Arr2jint = array of Arr1jint;
  44. Arr2jlong = array of Arr1jlong;
  45. Arr2jchar = array of Arr1jchar;
  46. Arr2jfloat = array of Arr1jfloat;
  47. Arr2jdouble = array of Arr1jdouble;
  48. Arr3jboolean = array of Arr2jboolean;
  49. Arr3jbyte = array of Arr2jbyte;
  50. Arr3jshort = array of Arr2jshort;
  51. Arr3jint = array of Arr2jint;
  52. Arr3jlong = array of Arr2jlong;
  53. Arr3jchar = array of Arr2jchar;
  54. Arr3jfloat = array of Arr2jfloat;
  55. Arr3jdouble = array of Arr2jdouble;
  56. const
  57. maxExitCode = 255;
  58. { Java base class type }
  59. {$i java_sysh.inc}
  60. {$i java_sys.inc}
  61. FpcEnumValueObtainable = interface
  62. function fpcOrdinal: jint;
  63. function fpcGenericValueOf(__fpc_int: longint): JLEnum;
  64. end;
  65. { generic versions are based on FPC/Delphi-style RTTI }
  66. {$define FPC_STR_ENUM_INTERN}
  67. {$i jrech.inc}
  68. {$i jseth.inc}
  69. {$i jpvarh.inc}
  70. {$i jsystemh_types.inc}
  71. {$i jtvarh.inc}
  72. {$i jsstringh.inc}
  73. {$i jdynarrh.inc}
  74. {$i jastringh.inc}
  75. {$i justringh.inc}
  76. {$i jsystemh.inc}
  77. {$i jtconh.inc}
  78. {*****************************************************************************}
  79. implementation
  80. {*****************************************************************************}
  81. function min(a,b : longint) : longint;
  82. begin
  83. if a<=b then
  84. min:=a
  85. else
  86. min:=b;
  87. end;
  88. {$i jtcon.inc}
  89. {$i jtvar.inc}
  90. {$i jsstrings.inc}
  91. {$i jastrings.inc}
  92. {$i justrings.inc}
  93. {$i jrec.inc}
  94. {$i jset.inc}
  95. {$i jpvar.inc}
  96. {$i jdynarr.inc}
  97. {$i jsystem.inc}
  98. {*****************************************************************************
  99. Misc. System Dependent Functions
  100. *****************************************************************************}
  101. procedure System_exit;
  102. begin
  103. JLRuntime.getRuntime.exit(ExitCode);
  104. end;
  105. procedure randomize;
  106. begin
  107. randseed:=JUCalendar.getInstance.getTimeInMillis;
  108. end;
  109. type
  110. CopyOutVarModifiedException = class(JLException)
  111. end;
  112. procedure fpc_var_copyout_mismatch(line,column: longint); compilerproc;
  113. var
  114. linestr,columnstr: unicodestring;
  115. begin
  116. str(line,linestr);
  117. str(column,columnstr);
  118. 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');
  119. end;
  120. {*****************************************************************************
  121. SystemUnit Initialization
  122. *****************************************************************************}
  123. end.