2
0

rttidecl.inc 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. {
  2. This file is part of the Free Pascal run time library.
  3. Copyright (c) 2018 by Sven Barth
  4. member of the Free Pascal development team
  5. Contains various RTTI related, private declarations that are used inside
  6. the system unit before rtti.inc might be included.
  7. See the file COPYING.FPC, included in this distribution,
  8. for details about the copyright.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  12. **********************************************************************}
  13. {$ifndef FPC_REQUIRES_PROPER_ALIGNMENT}
  14. {$define USE_PACKED}
  15. {$endif}
  16. {$ifdef VER2_6}
  17. {$define USE_PACKED}
  18. {$endif}
  19. {$ifndef VER3_0}
  20. { 3.1.1 and newer also (re)stores $MinEnumSize and $PackSet upon $Push/$Pop }
  21. {$push}
  22. {$endif}
  23. {$MINENUMSIZE 1 this saves a lot of memory }
  24. {$ifdef FPC_RTTI_PACKSET1}
  25. { for Delphi compatibility }
  26. {$packset 1}
  27. {$endif}
  28. type
  29. PTypeKind = ^TTypeKind;
  30. const
  31. // all potentially managed types
  32. tkManagedTypes = [tkAstring,tkWstring,tkUstring,tkArray,
  33. tkObject,tkRecord,tkDynArray,tkInterface,tkVariant];
  34. type
  35. PRecordElement=^TRecordElement;
  36. TRecordElement=
  37. {$ifdef USE_PACKED}
  38. packed
  39. {$endif USE_PACKED}
  40. record
  41. {$ifdef VER3_0}
  42. TypeInfo: Pointer;
  43. {$else}
  44. TypeInfo: PPointer;
  45. {$endif}
  46. {$ifdef VER2_6}
  47. Offset: Longint;
  48. {$else}
  49. Offset: SizeInt;
  50. {$endif}
  51. end;
  52. PRecordInfoFull=^TRecordInfoFull;
  53. TRecordInfoFull=
  54. {$ifdef USE_PACKED}
  55. packed
  56. {$endif USE_PACKED}
  57. record
  58. {$ifndef VER3_0}
  59. InitTable: Pointer;
  60. {$endif VER3_0}
  61. Size: Longint;
  62. Count: Longint;
  63. { Elements: array[count] of TRecordElement }
  64. end;
  65. PRecordInfoInit=^TRecordInfoInit;
  66. {$ifndef VER3_0}
  67. TRTTIRecVarOp=procedure(ARec: Pointer);
  68. TRTTIRecCopyOp=procedure(ASrc, ADest: Pointer);
  69. TRTTIRecOpType=(rotAny, rotInitialize, rotFinalize, rotAddRef, rotCopy);
  70. PRTTIRecordOpVMT=^TRTTIRecordOpVMT;
  71. TRTTIRecordOpVMT=
  72. {$ifdef USE_PACKED}
  73. packed
  74. {$endif USE_PACKED}
  75. record
  76. Initialize: TRTTIRecVarOp;
  77. Finalize: TRTTIRecVarOp;
  78. AddRef: TRTTIRecVarOp;
  79. Copy: TRTTIRecCopyOp;
  80. end;
  81. TRTTIRecordOpOffsetEntry =
  82. {$ifdef USE_PACKED}
  83. packed
  84. {$endif USE_PACKED}
  85. record
  86. ManagmentOperator: CodePointer;
  87. FieldOffset: SizeUInt;
  88. end;
  89. TRTTIRecordOpOffsetTable =
  90. {$ifdef USE_PACKED}
  91. packed
  92. {$endif USE_PACKED}
  93. record
  94. Count: LongWord;
  95. Entries: array[0..0] of TRTTIRecordOpOffsetEntry;
  96. end;
  97. PRTTIRecordOpOffsetTable = ^TRTTIRecordOpOffsetTable;
  98. TRecordInfoInit=
  99. {$ifdef USE_PACKED}
  100. packed
  101. {$endif USE_PACKED}
  102. record
  103. Terminator: Pointer;
  104. Size: Longint;
  105. {$ifndef VER3_0}
  106. InitRecordOpTable: PRTTIRecordOpOffsetTable;
  107. RecordOp: PRTTIRecordOpVMT;
  108. {$endif VER3_0}
  109. Count: Longint;
  110. { Elements: array[count] of TRecordElement }
  111. end;
  112. {$else VER3_0}
  113. TRecordInfoInit=TRecordInfoFull;
  114. {$endif VER3_0}
  115. PArrayInfo=^TArrayInfo;
  116. TArrayInfo=
  117. {$ifdef USE_PACKED}
  118. packed
  119. {$endif USE_PACKED}
  120. record
  121. Size: SizeInt;
  122. ElCount: SizeInt;
  123. {$ifdef VER3_0}
  124. ElInfo: Pointer;
  125. {$else}
  126. ElInfo: PPointer;
  127. {$endif}
  128. DimCount: Byte;
  129. Dims:array[0..255] of Pointer;
  130. end;
  131. {$ifndef VER3_0}
  132. function RTTIRecordMopInitTable(ti: Pointer): PRTTIRecordOpOffsetTable; forward;
  133. {$endif VER3_0}
  134. {$ifdef VER3_0}
  135. {$MINENUMSIZE DEFAULT}
  136. {$PACKSET DEFAULT}
  137. {$else}
  138. {$pop}
  139. {$endif}