system.pp 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660
  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-}
  19. {$implicitexceptions off}
  20. {$mode objfpc}
  21. {$undef FPC_HAS_FEATURE_ANSISTRINGS}
  22. {$undef FPC_HAS_FEATURE_TEXTIO}
  23. {$undef FPC_HAS_FEATURE_VARIANTS}
  24. {$undef FPC_HAS_FEATURE_CLASSES}
  25. {$undef FPC_HAS_FEATURE_EXCEPTIONS}
  26. {$undef FPC_HAS_FEATURE_OBJECTS}
  27. {$undef FPC_HAS_FEATURE_RTTI}
  28. {$undef FPC_HAS_FEATURE_FILEIO}
  29. {$undef FPC_INCLUDE_SOFTWARE_INT64_TO_DOUBLE}
  30. Type
  31. { The compiler has all integer types defined internally. Here
  32. we define only aliases }
  33. DWord = LongWord;
  34. Cardinal = LongWord;
  35. Integer = SmallInt;
  36. UInt64 = QWord;
  37. SizeInt = Longint;
  38. SizeUInt = Longint;
  39. PtrInt = Longint;
  40. PtrUInt = Longint;
  41. ValReal = Double;
  42. AnsiChar = Char;
  43. UnicodeChar = WideChar;
  44. { map comp to int64, }
  45. Comp = Int64;
  46. HResult = type longint;
  47. { Java primitive types }
  48. jboolean = boolean;
  49. jbyte = shortint;
  50. jshort = smallint;
  51. jint = longint;
  52. jlong = int64;
  53. jchar = widechar;
  54. jfloat = single;
  55. jdouble = double;
  56. Arr1jboolean = array of jboolean;
  57. Arr1jbyte = array of jbyte;
  58. Arr1jshort = array of jshort;
  59. Arr1jint = array of jint;
  60. Arr1jlong = array of jlong;
  61. Arr1jchar = array of jchar;
  62. Arr1jfloat = array of jfloat;
  63. Arr1jdouble = array of jdouble;
  64. Arr2jboolean = array of Arr1jboolean;
  65. Arr2jbyte = array of Arr1jbyte;
  66. Arr2jshort = array of Arr1jshort;
  67. Arr2jint = array of Arr1jint;
  68. Arr2jlong = array of Arr1jlong;
  69. Arr2jchar = array of Arr1jchar;
  70. Arr2jfloat = array of Arr1jfloat;
  71. Arr2jdouble = array of Arr1jdouble;
  72. Arr3jboolean = array of Arr2jboolean;
  73. Arr3jbyte = array of Arr2jbyte;
  74. Arr3jshort = array of Arr2jshort;
  75. Arr3jint = array of Arr2jint;
  76. Arr3jlong = array of Arr2jlong;
  77. Arr3jchar = array of Arr2jchar;
  78. Arr3jfloat = array of Arr2jfloat;
  79. Arr3jdouble = array of Arr2jdouble;
  80. const
  81. { max. values for longint and int}
  82. maxLongint = $7fffffff;
  83. maxSmallint = 32767;
  84. maxint = maxsmallint;
  85. { Java base class type }
  86. {$i java_sysh.inc}
  87. {$i java_sys.inc}
  88. type
  89. TObject = class(JLObject)
  90. strict private
  91. DestructorCalled: Boolean;
  92. public
  93. procedure Free;
  94. destructor Destroy; virtual;
  95. procedure finalize; override;
  96. end;
  97. {$i innr.inc}
  98. {$i jmathh.inc}
  99. {$i jrech.inc}
  100. {$i jdynarrh.inc}
  101. {$ifndef nounsupported}
  102. type
  103. tmethod = record
  104. code: jlobject;
  105. end;
  106. const
  107. vtInteger = 0;
  108. vtBoolean = 1;
  109. vtChar = 2;
  110. {$ifndef FPUNONE}
  111. vtExtended = 3;
  112. {$endif}
  113. vtString = 4;
  114. vtPointer = 5;
  115. vtPChar = 6;
  116. vtObject = 7;
  117. vtClass = 8;
  118. vtWideChar = 9;
  119. vtPWideChar = 10;
  120. vtAnsiString = 11;
  121. vtCurrency = 12;
  122. vtVariant = 13;
  123. vtInterface = 14;
  124. vtWideString = 15;
  125. vtInt64 = 16;
  126. vtQWord = 17;
  127. vtUnicodeString = 18;
  128. type
  129. TVarRec = record
  130. case VType : sizeint of
  131. {$ifdef ENDIAN_BIG}
  132. vtInteger : ({$IFDEF CPU64}integerdummy1 : Longint;{$ENDIF CPU64}VInteger: Longint);
  133. vtBoolean : ({$IFDEF CPU64}booldummy : Longint;{$ENDIF CPU64}booldummy1,booldummy2,booldummy3: byte; VBoolean: Boolean);
  134. vtChar : ({$IFDEF CPU64}chardummy : Longint;{$ENDIF CPU64}chardummy1,chardummy2,chardummy3: byte; VChar: Char);
  135. vtWideChar : ({$IFDEF CPU64}widechardummy : Longint;{$ENDIF CPU64}wchardummy1,VWideChar: WideChar);
  136. {$else ENDIAN_BIG}
  137. vtInteger : (VInteger: Longint);
  138. vtBoolean : (VBoolean: Boolean);
  139. vtChar : (VChar: Char);
  140. vtWideChar : (VWideChar: WideChar);
  141. {$endif ENDIAN_BIG}
  142. // vtString : (VString: PShortString);
  143. // vtPointer : (VPointer: Pointer);
  144. /// vtPChar : (VPChar: PChar);
  145. vtObject : (VObject: TObject);
  146. // vtClass : (VClass: TClass);
  147. // vtPWideChar : (VPWideChar: PWideChar);
  148. vtAnsiString : (VAnsiString: JLString);
  149. vtCurrency : (VCurrency: Currency);
  150. // vtVariant : (VVariant: PVariant);
  151. vtInterface : (VInterface: JLObject);
  152. vtWideString : (VWideString: JLString);
  153. vtInt64 : (VInt64: Int64);
  154. vtUnicodeString : (VUnicodeString: JLString);
  155. vtQWord : (VQWord: QWord);
  156. end;
  157. {$endif}
  158. Function lo(i : Integer) : byte; [INTERNPROC: fpc_in_lo_Word];
  159. Function lo(w : Word) : byte; [INTERNPROC: fpc_in_lo_Word];
  160. Function lo(l : Longint) : Word; [INTERNPROC: fpc_in_lo_long];
  161. Function lo(l : DWord) : Word; [INTERNPROC: fpc_in_lo_long];
  162. Function lo(i : Int64) : DWord; [INTERNPROC: fpc_in_lo_qword];
  163. Function lo(q : QWord) : DWord; [INTERNPROC: fpc_in_lo_qword];
  164. Function hi(i : Integer) : byte; [INTERNPROC: fpc_in_hi_Word];
  165. Function hi(w : Word) : byte; [INTERNPROC: fpc_in_hi_Word];
  166. Function hi(l : Longint) : Word; [INTERNPROC: fpc_in_hi_long];
  167. Function hi(l : DWord) : Word; [INTERNPROC: fpc_in_hi_long];
  168. Function hi(i : Int64) : DWord; [INTERNPROC: fpc_in_hi_qword];
  169. Function hi(q : QWord) : DWord; [INTERNPROC: fpc_in_hi_qword];
  170. Function chr(b : byte) : AnsiChar; [INTERNPROC: fpc_in_chr_byte];
  171. function RorByte(Const AValue : Byte): Byte;[internproc:fpc_in_ror_x];
  172. function RorByte(Const AValue : Byte;Dist : Byte): Byte;[internproc:fpc_in_ror_x_x];
  173. function RolByte(Const AValue : Byte): Byte;[internproc:fpc_in_rol_x];
  174. function RolByte(Const AValue : Byte;Dist : Byte): Byte;[internproc:fpc_in_rol_x_x];
  175. function RorWord(Const AValue : Word): Word;[internproc:fpc_in_ror_x];
  176. function RorWord(Const AValue : Word;Dist : Byte): Word;[internproc:fpc_in_ror_x_x];
  177. function RolWord(Const AValue : Word): Word;[internproc:fpc_in_rol_x];
  178. function RolWord(Const AValue : Word;Dist : Byte): Word;[internproc:fpc_in_rol_x_x];
  179. function RorDWord(Const AValue : DWord): DWord;[internproc:fpc_in_ror_x];
  180. function RorDWord(Const AValue : DWord;Dist : Byte): DWord;[internproc:fpc_in_ror_x_x];
  181. function RolDWord(Const AValue : DWord): DWord;[internproc:fpc_in_rol_x];
  182. function RolDWord(Const AValue : DWord;Dist : Byte): DWord;[internproc:fpc_in_rol_x_x];
  183. function RorQWord(Const AValue : QWord): QWord;[internproc:fpc_in_ror_x];
  184. function RorQWord(Const AValue : QWord;Dist : Byte): QWord;[internproc:fpc_in_ror_x_x];
  185. function RolQWord(Const AValue : QWord): QWord;[internproc:fpc_in_rol_x];
  186. function RolQWord(Const AValue : QWord;Dist : Byte): QWord;[internproc:fpc_in_rol_x_x];
  187. function SarShortint(Const AValue : Shortint): Shortint;[internproc:fpc_in_sar_x];
  188. function SarShortint(Const AValue : Shortint;Shift : Byte): Shortint;[internproc:fpc_in_sar_x_y];
  189. function SarSmallint(Const AValue : Smallint): Smallint;[internproc:fpc_in_sar_x];
  190. function SarSmallint(Const AValue : Smallint;Shift : Byte): Smallint;[internproc:fpc_in_sar_x_y];
  191. function SarLongint(Const AValue : Longint): Longint;[internproc:fpc_in_sar_x];
  192. function SarLongint(Const AValue : Longint;Shift : Byte): Longint;[internproc:fpc_in_sar_x_y];
  193. function SarInt64(Const AValue : Int64): Int64;[internproc:fpc_in_sar_x];
  194. function SarInt64(Const AValue : Int64;Shift : Byte): Int64;[internproc:fpc_in_sar_x_y];
  195. {$i compproc.inc}
  196. {$i ustringh.inc}
  197. {*****************************************************************************}
  198. implementation
  199. {*****************************************************************************}
  200. {i jdynarr.inc}
  201. {
  202. This file is part of the Free Pascal run time library.
  203. Copyright (c) 2011 by Jonas Maebe
  204. member of the Free Pascal development team.
  205. This file implements the helper routines for dyn. Arrays in FPC
  206. See the file COPYING.FPC, included in this distribution,
  207. for details about the copyright.
  208. This program is distributed in the hope that it will be useful,
  209. but WITHOUT ANY WARRANTY; without even the implied warranty of
  210. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  211. **********************************************************************
  212. }
  213. {$ifndef nounsupported}
  214. {$i astrings.inc}
  215. {$endif}
  216. {$i ustrings.inc}
  217. {$i rtti.inc}
  218. {$i jrec.inc}
  219. function min(a,b : longint) : longint;
  220. begin
  221. if a<=b then
  222. min:=a
  223. else
  224. min:=b;
  225. end;
  226. { copying helpers }
  227. { also for booleans }
  228. procedure fpc_copy_jbyte_array(src, dst: TJByteArray);
  229. var
  230. srclen, dstlen: jint;
  231. begin
  232. srclen:=length(src);
  233. dstlen:=length(dst);
  234. { causes exception in JLSystem.arraycopy }
  235. if (srclen=0) or
  236. (dstlen=0) then
  237. exit;
  238. JLSystem.arraycopy(JLObject(src),0,JLObject(dst),0,min(srclen,dstlen));
  239. end;
  240. procedure fpc_copy_jshort_array(src, dst: TJShortArray);
  241. var
  242. srclen, dstlen: jint;
  243. begin
  244. srclen:=length(src);
  245. dstlen:=length(dst);
  246. { causes exception in JLSystem.arraycopy }
  247. if (srclen=0) or
  248. (dstlen=0) then
  249. exit;
  250. JLSystem.arraycopy(JLObject(src),0,JLObject(dst),0,min(srclen,dstlen));
  251. end;
  252. procedure fpc_copy_jint_array(src, dst: TJIntArray);
  253. var
  254. srclen, dstlen: jint;
  255. begin
  256. srclen:=length(src);
  257. dstlen:=length(dst);
  258. { causes exception in JLSystem.arraycopy }
  259. if (srclen=0) or
  260. (dstlen=0) then
  261. exit;
  262. JLSystem.arraycopy(JLObject(src),0,JLObject(dst),0,min(srclen,dstlen));
  263. end;
  264. procedure fpc_copy_jlong_array(src, dst: TJLongArray);
  265. var
  266. srclen, dstlen: jint;
  267. begin
  268. srclen:=length(src);
  269. dstlen:=length(dst);
  270. { causes exception in JLSystem.arraycopy }
  271. if (srclen=0) or
  272. (dstlen=0) then
  273. exit;
  274. JLSystem.arraycopy(JLObject(src),0,JLObject(dst),0,min(srclen,dstlen));
  275. end;
  276. procedure fpc_copy_jchar_array(src, dst: TJCharArray);
  277. var
  278. srclen, dstlen: jint;
  279. begin
  280. srclen:=length(src);
  281. dstlen:=length(dst);
  282. { causes exception in JLSystem.arraycopy }
  283. if (srclen=0) or
  284. (dstlen=0) then
  285. exit;
  286. JLSystem.arraycopy(JLObject(src),0,JLObject(dst),0,min(srclen,dstlen));
  287. end;
  288. procedure fpc_copy_jfloat_array(src, dst: TJFloatArray);
  289. var
  290. srclen, dstlen: jint;
  291. begin
  292. srclen:=length(src);
  293. dstlen:=length(dst);
  294. { causes exception in JLSystem.arraycopy }
  295. if (srclen=0) or
  296. (dstlen=0) then
  297. exit;
  298. JLSystem.arraycopy(JLObject(src),0,JLObject(dst),0,min(srclen,dstlen));
  299. end;
  300. procedure fpc_copy_jdouble_array(src, dst: TJDoubleArray);
  301. var
  302. srclen, dstlen: jint;
  303. begin
  304. srclen:=length(src);
  305. dstlen:=length(dst);
  306. { causes exception in JLSystem.arraycopy }
  307. if (srclen=0) or
  308. (dstlen=0) then
  309. exit;
  310. JLSystem.arraycopy(JLObject(src),0,JLObject(dst),0,min(srclen,dstlen));
  311. end;
  312. procedure fpc_copy_jobject_array(src, dst: TJObjectArray);
  313. var
  314. srclen, dstlen: jint;
  315. begin
  316. srclen:=length(src);
  317. dstlen:=length(dst);
  318. { causes exception in JLSystem.arraycopy }
  319. if (srclen=0) or
  320. (dstlen=0) then
  321. exit;
  322. JLSystem.arraycopy(JLObject(src),0,JLObject(dst),0,min(srclen,dstlen));
  323. end;
  324. procedure fpc_copy_jrecord_array(src, dst: TJRecordArray);
  325. var
  326. i: longint;
  327. begin
  328. { no arraycopy, have to clone each element }
  329. for i:=0 to min(high(src),high(dst)) do
  330. dst[i]:=FpcBaseRecordType(src[i].clone);
  331. end;
  332. { 1-dimensional setlength routines }
  333. function fpc_setlength_dynarr_jbyte(aorg, anew: TJByteArray; deepcopy: boolean): TJByteArray;
  334. begin
  335. if deepcopy or
  336. (length(aorg)<>length(anew)) then
  337. begin
  338. fpc_copy_jbyte_array(aorg,anew);
  339. result:=anew
  340. end
  341. else
  342. result:=aorg;
  343. end;
  344. function fpc_setlength_dynarr_jshort(aorg, anew: TJShortArray; deepcopy: boolean): TJShortArray;
  345. begin
  346. if deepcopy or
  347. (length(aorg)<>length(anew)) then
  348. begin
  349. fpc_copy_jshort_array(aorg,anew);
  350. result:=anew
  351. end
  352. else
  353. result:=aorg;
  354. end;
  355. function fpc_setlength_dynarr_jint(aorg, anew: TJIntArray; deepcopy: boolean): TJIntArray;
  356. begin
  357. if deepcopy or
  358. (length(aorg)<>length(anew)) then
  359. begin
  360. fpc_copy_jint_array(aorg,anew);
  361. result:=anew
  362. end
  363. else
  364. result:=aorg;
  365. end;
  366. function fpc_setlength_dynarr_jlong(aorg, anew: TJLongArray; deepcopy: boolean): TJLongArray;
  367. begin
  368. if deepcopy or
  369. (length(aorg)<>length(anew)) then
  370. begin
  371. fpc_copy_jlong_array(aorg,anew);
  372. result:=anew
  373. end
  374. else
  375. result:=aorg;
  376. end;
  377. function fpc_setlength_dynarr_jchar(aorg, anew: TJCharArray; deepcopy: boolean): TJCharArray;
  378. begin
  379. if deepcopy or
  380. (length(aorg)<>length(anew)) then
  381. begin
  382. fpc_copy_jchar_array(aorg,anew);
  383. result:=anew
  384. end
  385. else
  386. result:=aorg;
  387. end;
  388. function fpc_setlength_dynarr_jfloat(aorg, anew: TJFloatArray; deepcopy: boolean): TJFloatArray;
  389. begin
  390. if deepcopy or
  391. (length(aorg)<>length(anew)) then
  392. begin
  393. fpc_copy_jfloat_array(aorg,anew);
  394. result:=anew
  395. end
  396. else
  397. result:=aorg;
  398. end;
  399. function fpc_setlength_dynarr_jdouble(aorg, anew: TJDoubleArray; deepcopy: boolean): TJDoubleArray;
  400. begin
  401. if deepcopy or
  402. (length(aorg)<>length(anew)) then
  403. begin
  404. fpc_copy_jdouble_array(aorg,anew);
  405. result:=anew
  406. end
  407. else
  408. result:=aorg;
  409. end;
  410. function fpc_setlength_dynarr_jobject(aorg, anew: TJObjectArray; deepcopy: boolean; docopy : boolean = true): TJObjectArray;
  411. begin
  412. if deepcopy or
  413. (length(aorg)<>length(anew)) then
  414. begin
  415. if docopy then
  416. fpc_copy_jobject_array(aorg,anew);
  417. result:=anew
  418. end
  419. else
  420. result:=aorg;
  421. end;
  422. function fpc_setlength_dynarr_jrecord(aorg, anew: TJRecordArray; deepcopy: boolean): TJRecordArray;
  423. begin
  424. if deepcopy or
  425. (length(aorg)<>length(anew)) then
  426. begin
  427. fpc_copy_jrecord_array(aorg,anew);
  428. result:=anew
  429. end
  430. else
  431. result:=aorg;
  432. end;
  433. { multi-dimensional setlength routine }
  434. function fpc_setlength_dynarr_multidim(aorg, anew: TJObjectArray; deepcopy: boolean; ndim: longint; eletype: jchar): TJObjectArray;
  435. var
  436. partdone,
  437. i: longint;
  438. begin
  439. { resize the current dimension; no need to copy the subarrays of the old
  440. array, as the subarrays will be (re-)initialised immediately below }
  441. result:=fpc_setlength_dynarr_jobject(aorg,anew,deepcopy,false);
  442. { if aorg was empty, there's nothing else to do since result will now
  443. contain anew, of which all other dimensions are already initialised
  444. correctly since there are no aorg elements to copy }
  445. if not assigned(aorg) and
  446. not deepcopy then
  447. exit;
  448. partdone:=min(high(result),high(aorg));
  449. { ndim must be >=2 when this routine is called, since it has to return
  450. an array of java.lang.Object! (arrays are also objects, but primitive
  451. types are not) }
  452. if ndim=2 then
  453. begin
  454. { final dimension -> copy the primitive arrays }
  455. case eletype of
  456. FPCJDynArrTypeJByte:
  457. begin
  458. for i:=low(result) to partdone do
  459. result[i]:=JLObject(fpc_setlength_dynarr_jbyte(TJByteArray(aorg[i]),TJByteArray(anew[i]),deepcopy));
  460. for i:=succ(partdone) to high(result) do
  461. result[i]:=JLObject(fpc_setlength_dynarr_jbyte(nil,TJByteArray(anew[i]),deepcopy));
  462. end;
  463. FPCJDynArrTypeJShort:
  464. begin
  465. for i:=low(result) to partdone do
  466. result[i]:=JLObject(fpc_setlength_dynarr_jshort(TJShortArray(aorg[i]),TJShortArray(anew[i]),deepcopy));
  467. for i:=succ(partdone) to high(result) do
  468. result[i]:=JLObject(fpc_setlength_dynarr_jshort(nil,TJShortArray(anew[i]),deepcopy));
  469. end;
  470. FPCJDynArrTypeJInt:
  471. begin
  472. for i:=low(result) to partdone do
  473. result[i]:=JLObject(fpc_setlength_dynarr_jint(TJIntArray(aorg[i]),TJIntArray(anew[i]),deepcopy));
  474. for i:=succ(partdone) to high(result) do
  475. result[i]:=JLObject(fpc_setlength_dynarr_jint(nil,TJIntArray(anew[i]),deepcopy));
  476. end;
  477. FPCJDynArrTypeJLong:
  478. begin
  479. for i:=low(result) to partdone do
  480. result[i]:=JLObject(fpc_setlength_dynarr_jlong(TJLongArray(aorg[i]),TJLongArray(anew[i]),deepcopy));
  481. for i:=succ(partdone) to high(result) do
  482. result[i]:=JLObject(fpc_setlength_dynarr_jlong(nil,TJLongArray(anew[i]),deepcopy));
  483. end;
  484. FPCJDynArrTypeJChar:
  485. begin
  486. for i:=low(result) to partdone do
  487. result[i]:=JLObject(fpc_setlength_dynarr_jchar(TJCharArray(aorg[i]),TJCharArray(anew[i]),deepcopy));
  488. for i:=succ(partdone) to high(result) do
  489. result[i]:=JLObject(fpc_setlength_dynarr_jchar(nil,TJCharArray(anew[i]),deepcopy));
  490. end;
  491. FPCJDynArrTypeJFloat:
  492. begin
  493. for i:=low(result) to partdone do
  494. result[i]:=JLObject(fpc_setlength_dynarr_jfloat(TJFloatArray(aorg[i]),TJFloatArray(anew[i]),deepcopy));
  495. for i:=succ(partdone) to high(result) do
  496. result[i]:=JLObject(fpc_setlength_dynarr_jfloat(nil,TJFloatArray(anew[i]),deepcopy));
  497. end;
  498. FPCJDynArrTypeJDouble:
  499. begin
  500. for i:=low(result) to partdone do
  501. result[i]:=JLObject(fpc_setlength_dynarr_jdouble(TJDoubleArray(aorg[i]),TJDoubleArray(anew[i]),deepcopy));
  502. for i:=succ(partdone) to high(result) do
  503. result[i]:=JLObject(fpc_setlength_dynarr_jdouble(nil,TJDoubleArray(anew[i]),deepcopy));
  504. end;
  505. FPCJDynArrTypeJObject:
  506. begin
  507. for i:=low(result) to partdone do
  508. result[i]:=JLObject(fpc_setlength_dynarr_jobject(TJObjectArray(aorg[i]),TJObjectArray(anew[i]),deepcopy,true));
  509. for i:=succ(partdone) to high(result) do
  510. result[i]:=JLObject(fpc_setlength_dynarr_jobject(nil,TJObjectArray(anew[i]),deepcopy,true));
  511. end;
  512. FPCJDynArrTypeRecord:
  513. begin
  514. for i:=low(result) to partdone do
  515. result[i]:=JLObject(fpc_setlength_dynarr_jrecord(TJRecordArray(aorg[i]),TJRecordArray(anew[i]),deepcopy));
  516. for i:=succ(partdone) to high(result) do
  517. result[i]:=JLObject(fpc_setlength_dynarr_jrecord(nil,TJRecordArray(anew[i]),deepcopy));
  518. end;
  519. end;
  520. end
  521. else
  522. begin
  523. { recursively handle the next dimension }
  524. for i:=low(result) to partdone do
  525. result[i]:=JLObject(fpc_setlength_dynarr_multidim(TJObjectArray(aorg[i]),TJObjectArray(anew[i]),deepcopy,pred(ndim),eletype));
  526. for i:=succ(partdone) to high(result) do
  527. result[i]:=JLObject(fpc_setlength_dynarr_multidim(nil,TJObjectArray(anew[i]),deepcopy,pred(ndim),eletype));
  528. end;
  529. end;
  530. {i jdynarr.inc end}
  531. {*****************************************************************************
  532. Misc. System Dependent Functions
  533. *****************************************************************************}
  534. procedure TObject.Free;
  535. begin
  536. if not DestructorCalled then
  537. begin
  538. DestructorCalled:=true;
  539. Destroy;
  540. end;
  541. end;
  542. destructor TObject.Destroy;
  543. begin
  544. end;
  545. procedure TObject.Finalize;
  546. begin
  547. Free;
  548. end;
  549. {*****************************************************************************
  550. SystemUnit Initialization
  551. *****************************************************************************}
  552. end.