Index: work/alien_formats/eagle/eagle_bin/test_parser/Makefile =================================================================== --- work/alien_formats/eagle/eagle_bin/test_parser/Makefile (revision 9537) +++ work/alien_formats/eagle/eagle_bin/test_parser/Makefile (revision 9538) @@ -1,7 +1,9 @@ -CFLAGS = -Wall -g -ansi -pedantic +CFLAGS = -Wall -g -ansi -pedantic -Dinline -main: main.o eagle_bin.o +main: main.o eagle_bin.o egb_tree.o -main.o: main.c eagle_bin.h +main.o: main.c eagle_bin.h egb_tree.h eagle_bin.o: eagle_bin.c eagle_bin.h + +egb_tree.o: egb_tree.c 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 (nonexistent) +++ work/alien_formats/eagle/eagle_bin/test_parser/egb_tree.c (revision 9538) @@ -0,0 +1,26 @@ +#include "egb_tree.h" + +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; +} + +egb_node_t *egb_node_append(egb_node_t *parent, egb_node_t *node) +{ + node->parent = parent; + node->next = NULL; + + if (parent->last_child == NULL) { + parent->last_child = node; + parent->first_child = node; + } + else { + parent->last_child->next = node; + parent->last_child = node; + } + return node; +} + Index: work/alien_formats/eagle/eagle_bin/test_parser/egb_tree.h =================================================================== --- work/alien_formats/eagle/eagle_bin/test_parser/egb_tree.h (nonexistent) +++ work/alien_formats/eagle/eagle_bin/test_parser/egb_tree.h (revision 9538) @@ -0,0 +1,18 @@ +/* eagle binary file tree representation */ + +#include + +typedef struct egb_node_s egb_node_t; + +struct egb_node_s { + int id; + const char *id_name; + htss_t props; + egb_node_t *parent; + egb_node_t *first_child, *last_child; +}; + + +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); +