#ifndef DATATYPE_H #define DATATYPE_H #include #include "Types.h" #define DT_INT32 0 #define DT_INT64 1 #define DT_FLOAT 2 #define DT_BOOL 3 #define DT_NULL 4 #define DT_VOID 5 #define DT_STRUCT 6 typedef struct { unsigned int type : 4; unsigned int pointers : 4; unsigned int constant : 1; unsigned int structId : 23; } DataType; typedef struct { const char* name; DataType type; } StructVariable; typedef struct { const char* name; int id; int amount; StructVariable* vars; } Struct; typedef struct { int capacity; int entries; Struct* data; } Structs; typedef struct { int32 array; int32 offset; } Pointer; int dtGetSize(DataType dt, Structs* sts); DataType dtInt32(); DataType dtInt64(); DataType dtFloat(); DataType dtBool(); DataType dtNull(); DataType dtText(); DataType dtVoid(); DataType dtStruct(Struct* st); DataType dtReference(DataType dt); bool dtDereference(DataType* dt); Struct* dtGetStruct(Structs* sts, DataType dt); DataType dtToVariable(DataType dt); bool dtRemoveVariable(DataType* dt); DataType dtConst(DataType dt); bool dtCompare(DataType a, DataType b); bool dtNullCompare(DataType a, DataType bOrNull); bool dtIsInt32(DataType dt); bool dtIsInt64(DataType dt); bool dtIsFloat(DataType dt); bool dtIsBool(DataType dt); bool dtIsNull(DataType dt); bool dtIsVoid(DataType dt); bool dtIsPointer(DataType dt); bool dtIsVariable(DataType dt); const char* dtGetName(Structs* sts, DataType dt); void stAddVariable(Struct* st, const char* name, DataType type); void stsInit(Structs* sts); void stsDelete(Structs* sts); Struct* stsSearch(Structs* sts, const char* name); Struct* stsAdd(Structs* sts, const char* name); void gstsInit(); void gstsDelete(); Structs* gstsGet(); Struct* gstsAdd(const char* name); #endif