- removed PClassType and PClassClass.

All non-actors now use PClass exclusively as their type descriptor.
Getting rid of these two classes already removes a lot of obtuse code from the type system, but there's still three more classes to go before a major cleanup can be undertaken.
This commit is contained in:
Christoph Oelckers 2017-02-07 20:45:56 +01:00
parent e3d07bddab
commit 3cddcc8524
3 changed files with 1 additions and 81 deletions

View file

@ -95,8 +95,6 @@ enum
CLASSREG_PClassActor,
CLASSREG_PClassInventory,
CLASSREG_PClassPlayerPawn,
CLASSREG_PClassType,
CLASSREG_PClassClass,
};
struct ClassReg

View file

@ -151,34 +151,6 @@ void DumpTypeTable()
Printf("Buckets of len %d: %d (%.2f%%)\n", j, lens[j], j!=0?double(lens[j])/used*100:-1.0);
}
/* PClassType *************************************************************/
IMPLEMENT_CLASS(PClassType, false, false)
//==========================================================================
//
// PClassType Constructor
//
//==========================================================================
PClassType::PClassType()
{
}
/* PClassClass ************************************************************/
IMPLEMENT_CLASS(PClassClass, false, false)
//==========================================================================
//
// PClassClass Constructor
//
//==========================================================================
PClassClass::PClassClass()
{
}
/* PType ******************************************************************/
IMPLEMENT_CLASS(PType, true, true)
@ -3014,28 +2986,19 @@ void PClass::StaticShutdown ()
//
// PClass :: StaticBootstrap STATIC
//
// PClass and PClassClass have intermingling dependencies on their
// definitions. To sort this out, we explicitly define them before
// proceeding with the RegisterClass loop in StaticInit().
//
//==========================================================================
void PClass::StaticBootstrap()
{
PClassClass *clscls = new PClassClass;
PClassClass::RegistrationInfo.SetupClass(clscls);
PClassClass *cls = new PClassClass;
PClass *cls = new PClass;
PClass::RegistrationInfo.SetupClass(cls);
// The PClassClass constructor initialized these to nullptr, because the
// PClass metadata had not been created yet. Now it has, so we know what
// they should be and can insert them into the type table successfully.
clscls->InsertIntoHash();
cls->InsertIntoHash();
// Create parent objects before we go so that these definitions are complete.
clscls->ParentClass = PClassType::RegistrationInfo.ParentType->RegisterClass();
cls->ParentClass = PClass::RegistrationInfo.ParentType->RegisterClass();
}
@ -3095,8 +3058,6 @@ PClass *ClassReg::RegisterClass()
&PClassActor::RegistrationInfo,
&PClassInventory::RegistrationInfo,
&PClassPlayerPawn::RegistrationInfo,
&PClassType::RegistrationInfo,
&PClassClass::RegistrationInfo,
};
// Skip classes that have already been registered

View file

@ -199,22 +199,13 @@ public:
// Prototype *+ *+
struct ZCC_ExprConstant;
class PClassType;
class PType : public PTypeBase
{
//DECLARE_ABSTRACT_CLASS_WITH_META(PType, DObject, PClassType);
// We need to unravel the _WITH_META macro, since PClassType isn't defined yet,
// and we can't define it until we've defined PClass. But we can't define that
// without defining PType.
DECLARE_ABSTRACT_CLASS(PType, PTypeBase)
HAS_OBJECT_POINTERS;
protected:
enum { MetaClassNum = CLASSREG_PClassType };
public:
typedef PClassType MetaClass;
MetaClass *GetClass() const;
PClass *TypeTableType; // The type to use for hashing into the type table
unsigned int Size; // this type's size
unsigned int Align; // this type's preferred alignment
@ -777,22 +768,17 @@ enum
TentativeClass = UINT_MAX,
};
class PClassClass;
class PClass : public PNativeStruct
{
DECLARE_CLASS(PClass, PNativeStruct);
HAS_OBJECT_POINTERS;
protected:
// We unravel _WITH_META here just as we did for PType.
enum { MetaClassNum = CLASSREG_PClassClass };
TArray<FTypeAndOffset> SpecialInits;
void Derive(PClass *newclass, FName name);
void InitializeSpecials(void *addr, void *defaults) const;
void SetSuper();
public:
typedef PClassClass MetaClass;
MetaClass *GetClass() const;
void WriteValue(FSerializer &ar, const char *key,const void *addr) const override;
void WriteAllFields(FSerializer &ar, const void *addr) const;
bool ReadValue(FSerializer &ar, const char *key,void *addr) const override;
@ -870,31 +856,6 @@ public:
static bool bVMOperational;
};
class PClassType : public PClass
{
DECLARE_CLASS(PClassType, PClass);
protected:
public:
PClassType();
};
inline PType::MetaClass *PType::GetClass() const
{
return static_cast<MetaClass *>(DObject::GetClass());
}
class PClassClass : public PClassType
{
DECLARE_CLASS(PClassClass, PClassType);
public:
PClassClass();
};
inline PClass::MetaClass *PClass::GetClass() const
{
return static_cast<MetaClass *>(DObject::GetClass());
}
// Type tables --------------------------------------------------------------
struct FTypeTable