Commit Graph

253 Commits

Author SHA1 Message Date
yury
9a01bcf3dc * Changed Integer to Longint in definitions of RTTI structures. It fixes typinfo for 16-bit CPUs.
git-svn-id: trunk@46503 -
2020-08-20 10:31:56 +00:00
svenbarth
a00be912aa * fix regression introduced with r42240: packed sets for the Integer based variants of SetToString/StringToSet need to be shifted on Big Endian systems
git-svn-id: trunk@43048 -
2019-09-21 14:36:19 +00:00
svenbarth
7e1607e095 * correct alignment for the property table
git-svn-id: trunk@42808 -
2019-08-24 23:08:36 +00:00
svenbarth
2dc771b7ba * TClassData also needs alignment dummies
git-svn-id: trunk@42807 -
2019-08-24 23:08:33 +00:00
svenbarth
2002650a23 * small corrections (grammar, casing, typo) for the comment for TCallConv
git-svn-id: trunk@42802 -
2019-08-24 23:08:17 +00:00
svenbarth
707e05d131 * check for CPUM68k instead of M68K; the latter should only be defined when building the compiler, so I wonder how that ever worked...
git-svn-id: trunk@42765 -
2019-08-22 20:45:48 +00:00
florian
1a67ffdd22 * fix alignment of ParamList
* fix test for architectures using aligned rtti

git-svn-id: trunk@42516 -
2019-07-28 12:43:15 +00:00
florian
23585ded15 * fix access to ParamFlags of the tkMethod branch of type data for CPUs requiring proper alignment
git-svn-id: trunk@42511 -
2019-07-28 11:55:19 +00:00
florian
73acb4d1c1 * fixes TInterfaceRawData to match TTypeData
git-svn-id: trunk@42486 -
2019-07-23 19:59:34 +00:00
nickysn
a3a39e1640 * i8086 compilation fix after changeset 42390
git-svn-id: trunk@42485 -
2019-07-23 11:57:20 +00:00
florian
217ae6e4bb * more fixes to rtti after attribute branch merging
git-svn-id: trunk@42476 -
2019-07-21 08:28:29 +00:00
svenbarth
71fa4d1fe2 * the RTTI of an attribute not only consists of the creation function, but also of the attribute's type, a pointer to the constructor and a data blob containing the constant parameters
+ added test

git-svn-id: trunk@42390 -
2019-07-12 22:07:05 +00:00
svenbarth
8cd1f1973b - remove unneeded local variable
git-svn-id: trunk@42386 -
2019-07-12 22:06:48 +00:00
svenbarth
affa9f9d9c * to be on the safe side: don't include AttributeTable fields when cycling
git-svn-id: trunk@42385 -
2019-07-12 22:06:44 +00:00
svenbarth
3ad24c9db8 * as attributes can be part of any type they are best suited in a common part of TTypeData
git-svn-id: trunk@42375 -
2019-07-12 22:06:09 +00:00
svenbarth
de15025a47 * streamline retrieval of attributes (both in TypInfo and RTTI units)
git-svn-id: trunk@42373 -
2019-07-12 22:06:02 +00:00
svenbarth
e060a43d70 * rename TAttributeData to the more appropriate TAttributeTable
git-svn-id: trunk@42371 -
2019-07-12 22:05:55 +00:00
svenbarth
c17dafc2f9 * fix TClassData by including the AttributeTable at the right location
git-svn-id: trunk@42370 -
2019-07-12 22:05:51 +00:00
svenbarth
e296b26e9e - remove unit info and related code again as that will be handled similar, but differently with dynamic packages
git-svn-id: trunk@42369 -
2019-07-12 22:05:47 +00:00
svenbarth
ee940c8270 * always write a class' reference to the attribute table, even if the unit does not have attributes
git-svn-id: trunk@42368 -
2019-07-12 22:05:42 +00:00
svenbarth
788d976f3a * use a Word instead of a Byte for the attribute index (after all the compiler writes a Word to the count field)
git-svn-id: trunk@42367 -
2019-07-12 22:05:39 +00:00
svenbarth
5153a288dc * it's more correct for GetPropAttribute to return a TCustomAttribute instead of a TObject
git-svn-id: trunk@42366 -
2019-07-12 22:05:33 +00:00
svenbarth
d137e06ade * instead of embedding the attributes inside the class' and property's type data only store a reference to a table of attributes
git-svn-id: trunk@42365 -
2019-07-12 22:05:29 +00:00
svenbarth
84848df18d Reintegration of Custom Attributes branch by Joost van der Sluis with patches reworked by Svetozar Belic [patch 3/3]
Added FPC_REQUIRES_PROPER_ALIGNMENT to TUnitInfo definition. Added FPC_HAS_EXTENDED_RTTI define.

git-svn-id: trunk@42358 -
2019-07-12 22:04:56 +00:00
svenbarth
b2932393df Reintegration of Custom Attributes branch by Joost van der Sluis with patches reworked by Svetozar Belic [patch 1/3]
Implemented attributes for class types and properties (based on work by Joost van der Sluis). Added TCustomAttribute - a base class for attributes. Added TUnitInfo record to RTTI. It contains the unit name and unit options (for now only a flag which specifies if the unit contains attributes). Added several tests for attributes.

git-svn-id: trunk@42356 -
2019-07-12 22:04:48 +00:00
svenbarth
cc5549f3e7 * change Value argument of SetToString and result of of StringToSet from Integer to LongInt so that small sets are handled on 8/16-bit platforms as they are on 32- and 64-bit
git-svn-id: trunk@42245 -
2019-06-17 20:48:58 +00:00
svenbarth
15d0deff81 * fix SetToString/StringToSet for 8/16-bit platforms
git-svn-id: trunk@42244 -
2019-06-17 20:48:49 +00:00
svenbarth
89e454aca8 * rework/extend SetToString/StringToSet so that sets with a size > 4 can be converted as well (this is Delphi compatible)
+ added test

git-svn-id: trunk@42240 -
2019-06-16 21:36:25 +00:00
svenbarth
a076677336 * instead of a flags field generate a table with all Initialize operators of all fields (nested or not, parent class or not) for class types; objects and records don't use this (yet)
git-svn-id: trunk@39690 -
2018-08-29 19:21:35 +00:00
svenbarth
2e1327b6b2 * use pooled constant references for the parameter locations as more often than not they're equal between multiple methdos (e.g. the Self argument is always the same)
* using this the TypInfo unit can navigate interface methods and VMT method parameters much more quickly as the latter have a constant size now

git-svn-id: trunk@39686 -
2018-08-29 19:20:31 +00:00
svenbarth
029ec93df6 * use pooled constant references for the names of VMT methods in the RTTI
git-svn-id: trunk@39685 -
2018-08-29 19:20:27 +00:00
svenbarth
228d3252cc * use pooled constant references for the parameter names of VMT methods in the RTTI
git-svn-id: trunk@39684 -
2018-08-29 19:20:24 +00:00
svenbarth
8536abce8a * as the management operator feature is not platform specific using a specific define for it aside from a
version check is unnecessary, thus remove the FPC_HAS_MANAGEMENT_OPERATOR define and instead check for VER3_0

git-svn-id: trunk@39257 -
2018-06-20 19:00:24 +00:00
svenbarth
ac0322c323 + add a flags field to the record init RTTI which declares whether
a) the current record contains a field with non-trivial initialization
    b) and of the parents contains such a field (only relevant for objects and classes)

git-svn-id: trunk@39255 -
2018-06-20 19:00:17 +00:00
michael
16ba47be46 * Patch from Ondrej Pokorny to convert unit names to CamelCase (bug ID 33481)
git-svn-id: trunk@38616 -
2018-03-23 22:06:36 +00:00
michael
3f09294aab * Functions to see whether a published property is readable or writeable
git-svn-id: trunk@37497 -
2017-10-20 19:41:56 +00:00
michael
a3bcefd78c * Use pointer get/set methods
git-svn-id: trunk@37496 -
2017-10-20 19:17:11 +00:00
michael
3d3bbcfa9c * Raise error if property cannot be written (Enhanced patch from Ondrej Pokorny, bug ID #32586)
git-svn-id: trunk@37495 -
2017-10-20 18:44:35 +00:00
svenbarth
7e3ad42f33 + add types for the VMT's message table (the names are Delphi compatible, even if TVmtMethodEntry has no Len field)
git-svn-id: trunk@37489 -
2017-10-18 19:38:03 +00:00
svenbarth
e6b39ebf15 + add methods for easier enumeration of the fields in a class' field table
git-svn-id: trunk@37484 -
2017-10-17 21:07:32 +00:00
svenbarth
0ba1073615 + add new type TVmtFieldClassTab for the class table of the field table (Delphi compatible)
git-svn-id: trunk@37483 -
2017-10-17 20:54:38 +00:00
svenbarth
1ae344394a + add data record for easier access to a class' data
git-svn-id: trunk@37420 -
2017-10-07 21:40:42 +00:00
svenbarth
5c97248f85 + also write the set's size to the RTTI as that simplifies handling in Invoke()
git-svn-id: trunk@37090 -
2017-08-31 19:23:12 +00:00
svenbarth
8b5461367b * move TTypeKind from TypInfo unit to System unit as it's necessary for the future GetTypeKind() intrinsic
* also adjust (P)Byte usages to (P/T)TypeKind where necessary/approbiate

git-svn-id: trunk@36873 -
2017-08-11 20:37:36 +00:00
michael
c788256fc9 * Added AddEnumElementAliases/TypInfo.RemoveEnumElementAliases (bug ID 30961)
git-svn-id: trunk@36719 -
2017-07-10 10:00:17 +00:00
Károly Balogh
ea635bfda5 typinfo: push/pop doesn't save packrecords. also, always use AlignTypeData on m68k, which might have less than pointer sized (word, 2 byte) alignments in the typeinfo, because on most systems C compilers also use 2 byte alignments, so we need that for compatibility
git-svn-id: trunk@36594 -
2017-06-24 23:18:12 +00:00
michael
ac207e867b * Fix bug ID #30952
git-svn-id: trunk@35900 -
2017-04-22 12:40:51 +00:00
maciej-izak
3900ccf260 * Rename RecordOp to ManagementOp (more relevant name)
git-svn-id: trunk@35453 -
2017-02-19 18:06:54 +00:00
maciej-izak
af8e0efe57 * Rtti info about Management Operators (MO) in init table for records. Note: commit contains minimal changes for RTL (for proper "make") no functional changes. More RTL changes for fully functionally MO in next commits.
compiler/ncgrtti.pas
  + write_record_operators procedure which fills simple VMT like table for MO.
  * recorddef_rtti save MO (if exists)
  * objectdef_rtti_fields save nil pointer/entry for objects rtti (have same RTL parts like for records)

compiler/options.pas
  + new define FPC_HAS_MANAGEMENT_OPERATORS

compiler/symconst.pas
  + new item itp_init_record_operators for tinternaltypeprefix enum
  + new entry '$init_record_operators$' in internaltypeprefixName

rtl/inc/rtti.inc
  + new field RecordOp (pointer to MO VMT table) in TRecordInfoInit
  + new types to handle MO VMT: TRTTIRecordOpVMT, PRTTIRecordOpVMT, TRTTIRecCopyOp, TRTTIRecVarOp

rtl/objpas/typinfo.pp
  + RecordOp field for TRecInitData record

git-svn-id: trunk@35445 -
2017-02-19 00:22:59 +00:00
svenbarth
870bffc70d * provide access to the method table for raw interfaces (it is written even though $M is not respected by such interfaces currently)
git-svn-id: trunk@35411 -
2017-02-10 16:03:57 +00:00