]> git.draconx.ca Git - cdecl99.git/blobdiff - src/cdecl.h
Rework library error reporting.
[cdecl99.git] / src / cdecl.h
index 1493d4db53c17f940a3c99b554a87de2eb82879d..0846cfd5c6780a96071141b05a71cf99baa23e1c 100644 (file)
@@ -102,15 +102,33 @@ void cdecl_free(struct cdecl *decl);
 size_t cdecl_explain(char *buf, size_t n, struct cdecl *decl);
 size_t cdecl_declare(char *buf, size_t n, struct cdecl *decl);
 
-static inline int cdecl_spec_kind(struct cdecl_declspec *spec)
+static inline int cdecl_spec_kind(const struct cdecl_declspec *spec)
 {
        return spec->type & ~(CDECL_SPEC_TYPE-1u);
 }
 
+static inline _Bool cdecl_is_abstract(const struct cdecl_declarator *d)
+{
+       while (d->child)
+               d = d->child;
+
+       return d->type != CDECL_DECL_IDENT;
+}
+
 /* Error handling. */
 enum {
-       CDECL_ENOMEM,
+       CDECL_ENOMEM = 1,
        CDECL_ENOPARSE,
+       CDECL_EBADARRAY,
+       CDECL_EBADDECL,
+       CDECL_EBADPARAMS,
+       CDECL_EBADPOINTER,
+       CDECL_EBADQUAL,
+       CDECL_EBADRETURN,
+       CDECL_EBADSTOR,
+       CDECL_EBADTYPE,
+       CDECL_ENOTFUNC,
+       CDECL_EVOIDPARAM
 };
 
 struct cdecl_error {