mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-12-14 14:41:12 +00:00
- Added NewStruct() function.
This commit is contained in:
parent
0ec33191aa
commit
7e24f6b00c
2 changed files with 46 additions and 0 deletions
|
@ -899,6 +899,27 @@ PMap *NewMap(PType *keytype, PType *valuetype)
|
||||||
|
|
||||||
IMPLEMENT_CLASS(PStruct)
|
IMPLEMENT_CLASS(PStruct)
|
||||||
|
|
||||||
|
//==========================================================================
|
||||||
|
//
|
||||||
|
// PStruct - Default Constructor
|
||||||
|
//
|
||||||
|
//==========================================================================
|
||||||
|
|
||||||
|
PStruct::PStruct()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//==========================================================================
|
||||||
|
//
|
||||||
|
// PStruct - Parameterized Constructor
|
||||||
|
//
|
||||||
|
//==========================================================================
|
||||||
|
|
||||||
|
PStruct::PStruct(FName name, DObject *outer)
|
||||||
|
: PNamedType(name, outer)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// PStruct :: PropagateMark
|
// PStruct :: PropagateMark
|
||||||
|
@ -915,6 +936,26 @@ size_t PStruct::PropagateMark()
|
||||||
return marked + Super::PropagateMark();
|
return marked + Super::PropagateMark();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//==========================================================================
|
||||||
|
//
|
||||||
|
// NewStruct
|
||||||
|
// Returns a PStruct for the given name and container, making sure not to
|
||||||
|
// create duplicates.
|
||||||
|
//
|
||||||
|
//==========================================================================
|
||||||
|
|
||||||
|
PStruct *NewStruct(FName name, DObject *outer)
|
||||||
|
{
|
||||||
|
size_t bucket;
|
||||||
|
PType *stype = TypeTable.FindType(RUNTIME_CLASS(PStruct), (intptr_t)outer, (intptr_t)name, &bucket);
|
||||||
|
if (stype == NULL)
|
||||||
|
{
|
||||||
|
stype = new PStruct(name, outer);
|
||||||
|
TypeTable.AddType(stype, RUNTIME_CLASS(PStruct), (intptr_t)outer, (intptr_t)name, bucket);
|
||||||
|
}
|
||||||
|
return static_cast<PStruct *>(stype);
|
||||||
|
}
|
||||||
|
|
||||||
/* PPrototype *************************************************************/
|
/* PPrototype *************************************************************/
|
||||||
|
|
||||||
IMPLEMENT_CLASS(PPrototype)
|
IMPLEMENT_CLASS(PPrototype)
|
||||||
|
|
|
@ -412,10 +412,14 @@ class PStruct : public PNamedType
|
||||||
{
|
{
|
||||||
DECLARE_CLASS(PStruct, PNamedType);
|
DECLARE_CLASS(PStruct, PNamedType);
|
||||||
public:
|
public:
|
||||||
|
PStruct(FName name, DObject *outer);
|
||||||
|
|
||||||
TArray<PField *> Fields;
|
TArray<PField *> Fields;
|
||||||
PSymbolTable Symbols;
|
PSymbolTable Symbols;
|
||||||
|
|
||||||
size_t PropagateMark();
|
size_t PropagateMark();
|
||||||
|
protected:
|
||||||
|
PStruct();
|
||||||
};
|
};
|
||||||
|
|
||||||
class PPrototype : public PCompoundType
|
class PPrototype : public PCompoundType
|
||||||
|
@ -585,6 +589,7 @@ PPointer *NewPointer(PType *type);
|
||||||
PClassPointer *NewClassPointer(PClass *restrict);
|
PClassPointer *NewClassPointer(PClass *restrict);
|
||||||
PClassWaitingForParent *NewUnknownClass(FName myname, FName parentname);
|
PClassWaitingForParent *NewUnknownClass(FName myname, FName parentname);
|
||||||
PEnum *NewEnum(FName name, DObject *outer);
|
PEnum *NewEnum(FName name, DObject *outer);
|
||||||
|
PStruct *NewStruct(FName name, DObject *outer);
|
||||||
|
|
||||||
// Built-in types -----------------------------------------------------------
|
// Built-in types -----------------------------------------------------------
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue