64# define offsetof(_t, _m) (size_t)(&(((_t *)0)->_m))
66#define bu_offsetof(_t, _m) (size_t)offsetof(_t, _m)
67#define bu_offsetofarray(_t, _a, _d, _i) bu_offsetof(_t, _a) + sizeof(_d) * _i
79#if defined(__ia64__) || defined(__x86_64__) || defined(__sparc64__) || defined(_HPUX_SOURCE) || defined(__clang__)
80# define bu_byteoffset(_i) ((size_t)((char *)&(_i)))
83# define bu_byteoffset(_i) ((size_t)(((char *)&(_i))-((char *)0)))
153#define BU_STRUCTPARSE_NULL ((struct bu_structparse *)0)
155#define BU_STRUCTPARSE_FUNC_NULL ((void(*)(const struct bu_structparse *, const char *, void *, const char *, void *))0)
173#define BU_CK_STRUCTPARSE(_sp)
178#define BU_STRUCTPARSE_INIT(_sp) { \
179 (_sp)->sp_fmt[0] = (_sp)->sp_fmt[1] = (_sp)->sp_fmt[2] = (_sp)->sp_fmt[3] = '\0'; \
180 (_sp)->sp_count = 0; \
181 (_sp)->sp_name = NULL; \
182 (_sp)->sp_offset = 0; \
183 (_sp)->sp_hook = BU_STRUCTPARSE_FUNC_NULL; \
184 (_sp)->sp_desc = NULL; \
185 (_sp)->sp_default = NULL; \
192#define BU_STRUCTPARSE_INIT_ZERO { {'\0', '\0', '\0', '\0'}, 0, NULL, 0, BU_STRUCTPARSE_FUNC_NULL, NULL, NULL }
198#define BU_STRUCTPARSE_IS_INITIALIZED(_sp) ((struct bu_structparse *)(_sp) != BU_STRUCTPARSE_NULL)
213#if defined(USE_BINARY_ATTRIBUTES)
214 unsigned char widcode;
221#define BU_EXTERNAL_NULL ((struct bu_external *)0)
226#define BU_CK_EXTERNAL(_p) BU_CKMAG(_p, BU_EXTERNAL_MAGIC, "bu_external")
231#if defined(USE_BINARY_ATTRIBUTES)
232# define BU_EXTERNAL_INIT(_p) { \
233 (_p)->ext_magic = BU_EXTERNAL_MAGIC; \
234 (_p)->ext_nbytes = 0; \
236 (_p)->ext_buf = NULL; \
239# define BU_EXTERNAL_INIT(_p) { \
240 (_p)->ext_magic = BU_EXTERNAL_MAGIC; \
241 (_p)->ext_nbytes = 0; \
242 (_p)->ext_buf = NULL; \
250#if defined(USE_BINARY_ATTRIBUTES)
251# define BU_EXTERNAL_INIT_ZERO { BU_EXTERNAL_MAGIC, 0, 0, NULL }
253# define BU_EXTERNAL_INIT_ZERO { BU_EXTERNAL_MAGIC, 0, NULL }
260#define BU_EXTERNAL_IS_INITIALIZED(_p) (((struct bu_external *)(_p) != BU_EXTERNAL_NULL) && (_p)->ext_magic == BU_EXTERNAL_MAGIC)
452#define BU_SP_SKIP_SEP(_cp) { \
453 while (*(_cp) && (*(_cp) == ' ' || *(_cp) == '\n' || \
454 *(_cp) == '\t' || *(_cp) == '{')) ++(_cp); \
Header file for the BRL-CAD common definitions.
int bu_structparse_argv(struct bu_vls *str, int argc, const char **argv, const struct bu_structparse *desc, char *base, void *data)
void bu_struct_wrap_buf(struct bu_external *ext, void *buf)
void bu_copy_external(struct bu_external *op, const struct bu_external *ip)
int bu_vls_struct_item_named(struct bu_vls *vp, const struct bu_structparse *sdp, const char *name, const char *base, int sep_char)
size_t bu_struct_get(struct bu_external *ext, FILE *fp)
int bu_struct_parse(const struct bu_vls *in_vls, const struct bu_structparse *desc, const char *base, void *data)
routines for parsing arbitrary structures
void bu_struct_print(const char *title, const struct bu_structparse *parsetab, const char *base)
void bu_vls_struct_print2(struct bu_vls *vls, const char *title, const struct bu_structparse *sdp, const char *base)
void bu_free_external(struct bu_external *ep)
size_t bu_struct_put(FILE *fp, const struct bu_external *ext)
void bu_vls_struct_item(struct bu_vls *vp, const struct bu_structparse *sdp, const char *base, int sep_char)
void bu_hexdump_external(FILE *fp, const struct bu_external *ep, const char *str)
int bu_shader_to_list(const char *in, struct bu_vls *vls)
void bu_structparse_get_terse_form(struct bu_vls *logstr, const struct bu_structparse *sp)
int bu_key_eq_to_key_val(const char *in, const char **next, struct bu_vls *vls)
int bu_shader_to_key_eq(const char *in, struct bu_vls *vls)
void bu_vls_struct_print(struct bu_vls *vls, const struct bu_structparse *sdp, const char *base)
int bu_struct_export(struct bu_external *ext, const void *base, const struct bu_structparse *imp)
char * bu_next_token(char *str)
int bu_struct_import(void *base, const struct bu_structparse *imp, const struct bu_external *ext, void *data)
int bu_fwrite_external(FILE *fp, const struct bu_external *ep)
Global registry of recognized magic numbers.
void(* sp_hook)(const struct bu_structparse *, const char *, void *, const char *, void *)
void(* sp_hook)(const struct bu_structparse *, const char *, void *, const char *, void *)