#ifndef DATATYPE_H #define DATATYPE_H #include #define DT_INT 0 #define DT_FLOAT 1 #define DT_BOOL 2 #define DT_VOID 3 #define DT_STRUCT 4 typedef struct { unsigned int type : 3; unsigned int reference : 1; unsigned int pointers : 4; unsigned int structId : 24; } 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; int dtGetSize(DataType dt, Structs* sts); DataType dtInt(); DataType dtFloat(); DataType dtBool(); DataType dtVoid(); DataType dtStruct(Struct* st); DataType dtToReference(DataType dt); DataType dtToArray(DataType dt, int dimension); bool dtIsArray(DataType dt); bool dtCompare(DataType a, DataType b); int dtMaxDimensions(); const char* dtGetName(Structs* sts, DataType dt); unsigned int dtAsInt(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); #endif