X-Git-Url: https://git.draconx.ca/gitweb/cdecl99.git/blobdiff_plain/08ac16e49d67a40f0f8127cf43f8a166626615dc..8df8a7c4f0b53f9f8bd51a3b80202adeb8031bcd:/src/cdecl.h diff --git a/src/cdecl.h b/src/cdecl.h index c4dad87..695024f 100644 --- a/src/cdecl.h +++ b/src/cdecl.h @@ -23,10 +23,10 @@ /* Declaration specifier kinds. */ enum { - CDECL_SPEC_TYPE = 0, - CDECL_SPEC_STOR = 256, - CDECL_SPEC_QUAL = 512, - CDECL_SPEC_FUNC = 1024, + CDECL_SPEC_TYPE = 256, + CDECL_SPEC_STOR = 512, + CDECL_SPEC_QUAL = 1024, + CDECL_SPEC_FUNC = 2048, }; enum { @@ -104,7 +104,28 @@ size_t cdecl_declare(char *buf, size_t n, struct cdecl *decl); static inline int cdecl_spec_kind(struct cdecl_declspec *spec) { - return spec->type & ~0xffu; + return spec->type & ~(CDECL_SPEC_TYPE-1u); } +static inline _Bool cdecl_is_abstract(struct cdecl_declarator *d) +{ + while (d->child) + d = d->child; + + return d->type != CDECL_DECL_IDENT; +} + +/* Error handling. */ +enum { + CDECL_ENOMEM, + CDECL_ENOPARSE, +}; + +struct cdecl_error { + unsigned code; + const char *str; +}; + +const struct cdecl_error *cdecl_get_error(void); + #endif