Index: work/alien_formats/eagle/eagle_bin/test_parser/Makefile =================================================================== --- work/alien_formats/eagle/eagle_bin/test_parser/Makefile (revision 9538) +++ work/alien_formats/eagle/eagle_bin/test_parser/Makefile (revision 9539) @@ -1,6 +1,8 @@ -CFLAGS = -Wall -g -ansi -pedantic -Dinline +GENHT=../../../../../trunk/src_3rd/liblihata/genht +CFLAGS = -Wall -g -ansi -pedantic -Dinline -I$(GENHT) +HASHO = $(GENHT)/hash.o $(GENHT)/htss.o -main: main.o eagle_bin.o egb_tree.o +main: main.o eagle_bin.o egb_tree.o $(HASHO) main.o: main.c eagle_bin.h egb_tree.h Index: work/alien_formats/eagle/eagle_bin/test_parser/egb_tree.c =================================================================== --- work/alien_formats/eagle/eagle_bin/test_parser/egb_tree.c (revision 9538) +++ work/alien_formats/eagle/eagle_bin/test_parser/egb_tree.c (revision 9539) @@ -1,11 +1,16 @@ +#include +#include #include "egb_tree.h" +#warning remove this on integration +#define pcb_strdup(s) strdup(s) + egb_node_t *egb_node_alloc(int id, const char *id_name) { egb_node_t *nd = calloc(sizeof(egb_node_t), 1); nd->id = id; nd->id_name = id_name; - return id; + return nd; } egb_node_t *egb_node_append(egb_node_t *parent, egb_node_t *node) @@ -24,3 +29,18 @@ return node; } + +void egb_node_prop_set(egb_node_t *node, const char *key, const char *val) +{ + if (node->props.table == NULL) + htss_init(&node->props, strhash, strkeyeq); + htss_set(&node->props, pcb_strdup(key), pcb_strdup(val)); +} + +char *egb_node_prop_get(egb_node_t *node, const char *key) +{ + if (node->props.table == NULL) + return NULL; + return htss_get(&node->props, key); +} + Index: work/alien_formats/eagle/eagle_bin/test_parser/egb_tree.h =================================================================== --- work/alien_formats/eagle/eagle_bin/test_parser/egb_tree.h (revision 9538) +++ work/alien_formats/eagle/eagle_bin/test_parser/egb_tree.h (revision 9539) @@ -9,6 +9,7 @@ const char *id_name; htss_t props; egb_node_t *parent; + egb_node_t *next; egb_node_t *first_child, *last_child; }; @@ -16,3 +17,6 @@ egb_node_t *egb_node_alloc(int id, const char *id_name); egb_node_t *egb_node_append(egb_node_t *parent, egb_node_t *node); +void egb_node_prop_set(egb_node_t *node, const char *key, const char *val); +char *egb_node_prop_get(egb_node_t *node, const char *key); +