#ifndef LIBWORLD_NBT_INTERNAL_H_INCLUDED #define LIBWORLD_NBT_INTERNAL_H_INCLUDED #include "nbt.h" #include "nbt/nbtht.internal.h" typedef struct { size_t len; nbt_byte_t *data; } nbt__byte_array_t; typedef struct { size_t len; nbt_int_t *data; } nbt__int_array_t; typedef struct { size_t len; nbt_long_t *data; } nbt__long_array_t; typedef struct { size_t len; char *data; } nbt__string_t; typedef struct nbt__compound_tag { nbt__ht_t *hash; } nbt__compound_t; typedef struct nbt__list_tag { size_t cap, len; nbt_tag_t **ptags; } nbt__list_t; typedef union { nbt_byte_t nbt_byte; nbt_short_t nbt_short; nbt_int_t nbt_int; nbt_long_t nbt_long; nbt_float_t nbt_float; nbt_double_t nbt_double; nbt__byte_array_t nbt_byte_array; nbt__string_t nbt_string; nbt__list_t nbt_list; nbt__compound_t nbt_compound; nbt__int_array_t nbt_int_array; nbt__long_array_t nbt_long_array; } nbt__any_t; struct nbt__tag_tag { size_t ref; nbt_type_t type; nbt__any_t value; }; /* a named tag */ typedef struct { nbt_tag_t tag; size_t name_length; char *name; /* nullable if there is no name (will be written as if the name is empty) */ } nbt__ntag_t; #define NBT__CHECK_TYPE(_tag, _t, _r, ...) do { \ if (!(_tag) || (_tag)->type != _t) { _r(__VA_ARGS__); } \ } while (0) /* functions */ void nbt__tag_free(nbt_tag_t *tag); extern const char *const nbt__type_names[]; #endif /* include guard */