mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-29 15:32:57 +00:00
Add the basic types to the global symbol table
This commit is contained in:
parent
03c4244fd8
commit
b227a2f508
6 changed files with 50 additions and 5 deletions
|
@ -58,6 +58,7 @@
|
|||
// PUBLIC DATA DEFINITIONS -------------------------------------------------
|
||||
|
||||
FTypeTable TypeTable;
|
||||
PSymbolTable GlobalSymbols;
|
||||
TArray<PClass *> PClass::AllClasses;
|
||||
bool PClass::bShutdown;
|
||||
|
||||
|
@ -458,6 +459,7 @@ void PType::GetTypeIDs(intptr_t &id1, intptr_t &id2) const
|
|||
|
||||
void PType::StaticInit()
|
||||
{
|
||||
// Set up TypeTable hash keys.
|
||||
RUNTIME_CLASS(PErrorType)->TypeTableType = RUNTIME_CLASS(PErrorType);
|
||||
RUNTIME_CLASS(PVoidType)->TypeTableType = RUNTIME_CLASS(PVoidType);
|
||||
RUNTIME_CLASS(PInt)->TypeTableType = RUNTIME_CLASS(PInt);
|
||||
|
@ -481,6 +483,7 @@ void PType::StaticInit()
|
|||
RUNTIME_CLASS(PFixed)->TypeTableType = RUNTIME_CLASS(PFixed);
|
||||
RUNTIME_CLASS(PAngle)->TypeTableType = RUNTIME_CLASS(PAngle);
|
||||
|
||||
// Create types and add them type the type table.
|
||||
TypeTable.AddType(TypeError = new PErrorType);
|
||||
TypeTable.AddType(TypeVoid = new PVoidType);
|
||||
TypeTable.AddType(TypeSInt8 = new PInt(1, false));
|
||||
|
@ -499,6 +502,26 @@ void PType::StaticInit()
|
|||
TypeTable.AddType(TypeState = new PStatePointer);
|
||||
TypeTable.AddType(TypeFixed = new PFixed);
|
||||
TypeTable.AddType(TypeAngle = new PAngle);
|
||||
|
||||
// Add types to the global symbol table.
|
||||
GlobalSymbols.AddSymbol(new PSymbolType(NAME_sbyte, TypeSInt8));
|
||||
GlobalSymbols.AddSymbol(new PSymbolType(NAME_byte, TypeUInt8));
|
||||
GlobalSymbols.AddSymbol(new PSymbolType(NAME_short, TypeSInt16));
|
||||
GlobalSymbols.AddSymbol(new PSymbolType(NAME_ushort, TypeUInt16));
|
||||
GlobalSymbols.AddSymbol(new PSymbolType(NAME_int, TypeSInt32));
|
||||
GlobalSymbols.AddSymbol(new PSymbolType(NAME_uint, TypeUInt32));
|
||||
GlobalSymbols.AddSymbol(new PSymbolType(NAME_bool, TypeBool));
|
||||
GlobalSymbols.AddSymbol(new PSymbolType(NAME_float, TypeFloat64));
|
||||
GlobalSymbols.AddSymbol(new PSymbolType(NAME_double, TypeFloat64));
|
||||
GlobalSymbols.AddSymbol(new PSymbolType(NAME_float32, TypeFloat32));
|
||||
GlobalSymbols.AddSymbol(new PSymbolType(NAME_float64, TypeFloat64));
|
||||
GlobalSymbols.AddSymbol(new PSymbolType(NAME_string, TypeString));
|
||||
GlobalSymbols.AddSymbol(new PSymbolType(NAME_name, TypeName));
|
||||
GlobalSymbols.AddSymbol(new PSymbolType(NAME_sound, TypeSound));
|
||||
GlobalSymbols.AddSymbol(new PSymbolType(NAME_color, TypeColor));
|
||||
GlobalSymbols.AddSymbol(new PSymbolType(NAME_state, TypeState));
|
||||
GlobalSymbols.AddSymbol(new PSymbolType(NAME_fixed, TypeFixed));
|
||||
GlobalSymbols.AddSymbol(new PSymbolType(NAME_angle, TypeAngle));
|
||||
}
|
||||
|
||||
|
||||
|
@ -2454,6 +2477,9 @@ IMPLEMENT_ABSTRACT_CLASS(PSymbol);
|
|||
IMPLEMENT_CLASS(PSymbolConst);
|
||||
IMPLEMENT_CLASS(PSymbolConstNumeric);
|
||||
IMPLEMENT_CLASS(PSymbolConstString);
|
||||
IMPLEMENT_POINTY_CLASS(PSymbolType)
|
||||
DECLARE_POINTER(Type)
|
||||
END_POINTERS
|
||||
IMPLEMENT_POINTY_CLASS(PSymbolVMFunction)
|
||||
DECLARE_POINTER(Function)
|
||||
END_POINTERS
|
||||
|
|
|
@ -55,6 +55,19 @@ public:
|
|||
PSymbolVMFunction() : PSymbol(NAME_None) {}
|
||||
};
|
||||
|
||||
// A symbol for a type ------------------------------------------------------
|
||||
|
||||
class PSymbolType : public PSymbol
|
||||
{
|
||||
DECLARE_CLASS(PSymbolType, PSymbol);
|
||||
HAS_OBJECT_POINTERS;
|
||||
public:
|
||||
class PType *Type;
|
||||
|
||||
PSymbolType(FName name, class PType *ty) : PSymbol(name), Type(ty) {}
|
||||
PSymbolType() : PSymbol(NAME_None) {}
|
||||
};
|
||||
|
||||
// A symbol table -----------------------------------------------------------
|
||||
|
||||
struct PSymbolTable
|
||||
|
@ -89,6 +102,8 @@ private:
|
|||
friend class DObject;
|
||||
};
|
||||
|
||||
extern PSymbolTable GlobalSymbols;
|
||||
|
||||
// Basic information shared by all types ------------------------------------
|
||||
|
||||
// Only one copy of a type is ever instantiated at one time.
|
||||
|
|
|
@ -578,7 +578,7 @@ xx(DecoNameToClass)
|
|||
xx(DecoFindMultiNameState)
|
||||
xx(DecoFindSingleNameState)
|
||||
|
||||
// fallback names for ZScript parser
|
||||
// basic type names
|
||||
xx(default)
|
||||
xx(sbyte)
|
||||
xx(byte)
|
||||
|
@ -588,8 +588,16 @@ xx(int)
|
|||
xx(uint)
|
||||
xx(bool)
|
||||
xx(float)
|
||||
xx(float32)
|
||||
xx(float64)
|
||||
xx(double)
|
||||
xx(string)
|
||||
xx(vector)
|
||||
xx(map)
|
||||
xx(array)
|
||||
xx(name)
|
||||
xx(sound)
|
||||
xx(color)
|
||||
xx(state)
|
||||
xx(fixed)
|
||||
xx(angle)
|
||||
|
|
|
@ -74,7 +74,6 @@ void ParseDecorate (FScanner &sc);
|
|||
|
||||
// STATIC FUNCTION PROTOTYPES --------------------------------------------
|
||||
PClassActor *QuestItemClasses[31];
|
||||
PSymbolTable GlobalSymbols;
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
|
|
|
@ -50,7 +50,6 @@
|
|||
#define SAFE_RESOLVE(p,c) RESOLVE(p,c); ABORT(p)
|
||||
|
||||
class VMFunctionBuilder;
|
||||
extern PSymbolTable GlobalSymbols;
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
|
|
|
@ -10,8 +10,6 @@
|
|||
|
||||
#define luai_nummod(a,b) ((a) - floor((a)/(b))*(b))
|
||||
|
||||
extern PSymbolTable GlobalSymbols;
|
||||
|
||||
ZCC_OpInfoType ZCC_OpInfo[PEX_COUNT_OF] =
|
||||
{
|
||||
#define xx(a,n) { n, #a, NULL },
|
||||
|
|
Loading…
Reference in a new issue