#ifndef DTOB_TYPES_H
#define DTOB_TYPES_H
#include "dtob.h"
#define DTOB_DEFINE_CUSTOM_TYPES(name, th, ...) \
static void build_##name##_custom_types(DtobTypesHeader *th) { \
dtob_types_init(th); \
__VA_ARGS__ \
}
#define DTOB_CUSTOM_TYPE_NULLABLE(th, code, str) \
dtob_types_add(th, code, str, NULL, 0);
#define DTOB_CUSTOM_TYPE_RAW(th, code, str) \
dtob_types_add(th, code, str, (uint16_t[]){DTOB_CODE_RAW}, 1);
#define DTOB_CUSTOM_TYPE_INT8(th, code, str) \
dtob_types_add(th, code, str, (uint16_t[]){DTOB_CODE_INT8}, 1);
#define DTOB_CUSTOM_TYPE_INT16(th, code, str) \
dtob_types_add(th, code, str, (uint16_t[]){DTOB_CODE_INT16}, 1);
#define DTOB_CUSTOM_TYPE_INT32(th, code, str) \
dtob_types_add(th, code, str, (uint16_t[]){DTOB_CODE_INT32}, 1);
#define DTOB_CUSTOM_TYPE_INT64(th, code, str) \
dtob_types_add(th, code, str, (uint16_t[]){DTOB_CODE_INT64}, 1);
#define DTOB_CUSTOM_TYPE_UINT8(th, code, str) \
dtob_types_add(th, code, str, (uint16_t[]){DTOB_CODE_UINT8}, 1);
#define DTOB_CUSTOM_TYPE_UINT16(th, code, str) \
dtob_types_add(th, code, str, (uint16_t[]){DTOB_CODE_UINT16}, 1);
#define DTOB_CUSTOM_TYPE_UINT32(th, code, str) \
dtob_types_add(th, code, str, (uint16_t[]){DTOB_CODE_UINT32}, 1);
#define DTOB_CUSTOM_TYPE_UINT64(th, code, str) \
dtob_types_add(th, code, str, (uint16_t[]){DTOB_CODE_UINT64}, 1);
#define DTOB_CUSTOM_TYPE_ENUM(th, code, str, ...) \
dtob_types_add(th, code, str, \
(uint16_t[]){__VA_ARGS__}, \
sizeof((uint16_t[]){__VA_ARGS__}) / sizeof(uint16_t));
#define DTOB_CUSTOM_TYPE_STRUCT(th, code, str, ...) \
dtob_types_add(th, code, str, \
(uint16_t[]){__VA_ARGS__}, \
sizeof((uint16_t[]){__VA_ARGS__}) / sizeof(uint16_t)); \
(th)->entries[(th)->count - 1].is_struct = 1;
#endif