Minor PField changes.

- Rename FieldOffset and FieldType so they no longer have the "Field" prefix
- Add a Flags field.
This commit is contained in:
Randy Heit 2013-08-21 22:38:05 -05:00
parent e50c00c856
commit 4cf0ef7e3f
2 changed files with 8 additions and 6 deletions

View file

@ -1099,10 +1099,10 @@ PField *PStruct::AddField(FName name, PType *type)
PField *field = new PField(name, type); PField *field = new PField(name, type);
// The new field is added to the end of this struct, alignment permitting. // The new field is added to the end of this struct, alignment permitting.
field->FieldOffset = (Size + (type->Align - 1)) & ~(type->Align - 1); field->Offset = (Size + (type->Align - 1)) & ~(type->Align - 1);
// Enlarge this struct to enclose the new field. // Enlarge this struct to enclose the new field.
Size = field->FieldOffset + type->Size; Size = field->Offset + type->Size;
// This struct's alignment is the same as the largest alignment of any of // This struct's alignment is the same as the largest alignment of any of
// its fields. // its fields.
@ -1161,7 +1161,7 @@ IMPLEMENT_CLASS(PField)
//========================================================================== //==========================================================================
PField::PField() PField::PField()
: PSymbol(NAME_None) : PSymbol(NAME_None), Offset(0), Type(NULL), Flags(0)
{ {
} }

View file

@ -325,10 +325,12 @@ class PField : public PSymbol
DECLARE_CLASS(PField, PSymbol); DECLARE_CLASS(PField, PSymbol);
HAS_OBJECT_POINTERS HAS_OBJECT_POINTERS
public: public:
PField(FName name, PType *type) : PSymbol(name), FieldOffset(0), FieldType(type) {} PField(FName name, PType *type) : PSymbol(name), Offset(0), Type(type), Flags(0) {}
PField(FName name, PType *type, DWORD flags) : PSymbol(name), Offset(0), Type(type), Flags(flags) {}
unsigned int FieldOffset; unsigned int Offset;
PType *FieldType; PType *Type;
DWORD Flags;
protected: protected:
PField(); PField();
}; };