32 lines
494 B
C
32 lines
494 B
C
#include "type.h"
|
|
|
|
RZ_ENUM_C(TypeKind, TYPE_KIND);
|
|
|
|
void type_init(type_t* type, TypeKind kind)
|
|
{
|
|
assert(type);
|
|
type->kind = kind;
|
|
}
|
|
|
|
void type_free(type_t* type)
|
|
{
|
|
assert(type);
|
|
}
|
|
|
|
int type_eq(type_t* type, type_t* rhs)
|
|
{
|
|
assert(type);
|
|
assert(rhs);
|
|
|
|
return type->kind == rhs->kind;
|
|
}
|
|
|
|
size_t type_str(type_t* type, char* buffer, size_t size)
|
|
{
|
|
assert(type);
|
|
assert(buffer);
|
|
|
|
return snprintf(buffer, size, "%s",
|
|
TypeKindStr[type->kind] + strlen("TYPE_"));
|
|
}
|