]> git.draconx.ca Git - cdecl99.git/blobdiff - src/cdecl.h
Fix build with new Bison versions.
[cdecl99.git] / src / cdecl.h
index 3217f9e46f6d1d267490cc9ebc7112f1a641459a..695024f5e8d63b9b9ada57e3b2db4b3170b89770 100644 (file)
 
 /* 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 {
@@ -41,6 +41,7 @@ enum {
        CDECL_TYPE_UNSIGNED,
        CDECL_TYPE_BOOL,
        CDECL_TYPE_COMPLEX,
+       CDECL_TYPE_IMAGINARY,
        CDECL_TYPE_STRUCT,
        CDECL_TYPE_UNION,
        CDECL_TYPE_ENUM,
@@ -95,13 +96,36 @@ struct cdecl {
 };
 
 struct cdecl *cdecl_parse_decl(const char *declstr);
+struct cdecl *cdecl_parse_english(const char *english);
 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)
 {
-       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