]> git.draconx.ca Git - cdecl99.git/blobdiff - src/cdecl.h
Fix broken include guard.
[cdecl99.git] / src / cdecl.h
index 90a8804d3210aadbd5677fbbfabc9045d9bcf6d9..807ad6a687145e4d0dab486a7d9c1036463b6300 100644 (file)
@@ -1,5 +1,8 @@
 #ifndef CDECL_H_
-#define CEDCL_H_
+#define CDECL_H_
+
+#include <stddef.h>
+#include <stdint.h>
 
 /* Declaration specifier kinds. */
 enum {
@@ -39,6 +42,8 @@ enum {
 /* Declarator types. */
 enum {
        CDECL_DECL_IDENT,
+       CDECL_DECL_POINTER,
+       CDECL_DECL_ARRAY,
 };
 
 struct cdecl {
@@ -49,15 +54,26 @@ struct cdecl {
        } *specifiers;
 
        struct cdecl_declarator {
-               struct cdecl_declarator *next;
+               struct cdecl_declarator *next, *child;
                unsigned type;
-               char *ident;
+               union {
+                       char *ident;
+                       struct cdecl_pointer {
+                               struct cdecl_declspec *qualifiers;
+                       } pointer;
+                       struct cdecl_array {
+                               char *vla;
+                               uintmax_t length;
+                       } array;
+               } u;
        } *declarators;
 };
 
 struct cdecl *cdecl_parse_decl(const char *declstr);
 void cdecl_free(struct cdecl *decl);
 
+size_t cdecl_explain(char *buf, size_t n, struct cdecl *decl);
+
 static inline int cdecl_spec_kind(struct cdecl_declspec *spec)
 {
        return spec->type & ~0xffu;