summaryrefslogtreecommitdiff
path: root/glcpp.h
diff options
context:
space:
mode:
authorCarl Worth <cworth@cworth.org>2010-05-12 12:17:10 -0700
committerCarl Worth <cworth@cworth.org>2010-05-12 12:25:34 -0700
commit33cc400714f379ef13e876b4aedd0de8cb5d033d (patch)
treeeb0fcb9c900079aebdab63af41d001af56e9736d /glcpp.h
parentdf2ab5b99237ab0b6760226554b133a5ccd11579 (diff)
Fix defines involving both literals and other defined macros.
We now store a list of tokens in our hash-table rather than a single string. This lets us replace each macro in the value as necessary. This code adds a link dependency on talloc which does exactly what we want in terms of memory management for a parser. The 3 tests added in the previous commit now pass.
Diffstat (limited to 'glcpp.h')
-rw-r--r--glcpp.h25
1 files changed, 17 insertions, 8 deletions
diff --git a/glcpp.h b/glcpp.h
index 5278e1b971..6fea9333e8 100644
--- a/glcpp.h
+++ b/glcpp.h
@@ -26,22 +26,31 @@
#include "hash_table.h"
-#define YYSTYPE char *
#define yyscan_t void*
-typedef struct {
- yyscan_t scanner;
- struct hash_table *defines;
-} glcpp_parser_t;
+/* Some data types used for parser value. */
-void
-glcpp_parser_init (glcpp_parser_t *parser);
+
+typedef struct node {
+ const char *str;
+ struct node *next;
+} node_t;
+
+typedef struct list {
+ node_t *head;
+ node_t *tail;
+} list_t;
+
+typedef struct glcpp_parser glcpp_parser_t;
+
+glcpp_parser_t *
+glcpp_parser_create (void);
int
glcpp_parser_parse (glcpp_parser_t *parser);
void
-glcpp_parser_fini (glcpp_parser_t *parser);
+glcpp_parser_destroy (glcpp_parser_t *parser);
/* Generated by glcpp-lex.l to glcpp-lex.c */