rtti.inc 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. {
  2. $Id$
  3. This file is part of the Free Pascal run time library.
  4. Copyright (c) 1999-2000 by Michael Van Canneyt
  5. member of the Free Pascal development team
  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. { Run-Time type information routines }
  13. { The RTTI is implemented through a series of constants : }
  14. Const
  15. tkUnknown = 0;
  16. tkInteger = 1;
  17. tkChar = 2;
  18. tkEnumeration = 3;
  19. tkFloat = 4;
  20. tkSet = 5;
  21. tkMethod = 6;
  22. tkSString = 7;
  23. tkString = tkSString;
  24. tkLString = 8;
  25. tkAString = 9;
  26. tkWString = 10;
  27. tkVariant = 11;
  28. tkArray = 12;
  29. tkRecord = 13;
  30. tkInterface = 14;
  31. tkClass = 15;
  32. tkObject = 16;
  33. tkWChar = 17;
  34. tkBool = 18;
  35. { A record is designed as follows :
  36. 1 : tkrecord
  37. 2 : Length of name string (n);
  38. 3 : name string;
  39. 3+n : record size;
  40. 7+n : number of elements (N)
  41. 11+n : N times : Pointer to type info
  42. Offset in record
  43. }
  44. Type
  45. TRecElem = Record
  46. Info : Pointer;
  47. Offset : Longint;
  48. end;
  49. TRecElemArray = Array[1..Maxint] of TRecElem;
  50. PRecRec = ^TRecRec;
  51. TRecRec = record
  52. Size,Count : Longint;
  53. Elements : TRecElemArray;
  54. end;
  55. { An array is designed as follows :
  56. 1 : tkArray;
  57. 2 : length of name string (n);
  58. 3 : NAme string
  59. 3+n : Element Size
  60. 7+n : Number of elements
  61. 11+n : Pointer to type of elements
  62. }
  63. PArrayRec = ^TArrayRec;
  64. TArrayRec = record
  65. Size,Count : Longint;
  66. Info : Pointer;
  67. end;
  68. { The actual Routines are implemented per processor. }
  69. {$i rttip.inc}
  70. {
  71. $Log$
  72. Revision 1.7 2000-06-14 08:52:05 michael
  73. + Fixed all constants so they match compiler defined constants
  74. Revision 1.6 2000/02/09 16:59:31 peter
  75. * truncated log
  76. Revision 1.5 2000/01/07 16:41:36 daniel
  77. * copyright 2000
  78. }