#include #include #include "objects.h" void *l_node_stiring_new(const char *text) { LNodeString *sn = (LNodeString *) malloc(sizeof(LNodeString)); LNode *n = (LNode *)sn; sn->value = text; n->type = String; n->prev = NULL; n->next = NULL; return sn; } void *l_node_integer_new(int value) { LNodeInteger *in = (LNodeInteger *) malloc(sizeof(LNodeInteger)); LNode *n = (LNode *)in; in->value = value; n->type = Integer; n->prev = NULL; n->next = NULL; return in; } void *l_node_append(void *_parent, void *_new) { LNode *p, *parent, *new; parent = (LNode *)_parent; new = (LNode *)new; p = parent; while (p->next != NULL) p = (LNode *)(p->next); new->prev = p; p->next = new; return parent; } void l_node_print(void *_obj) { LNode *obj = (LNode *)_obj; while (obj) { switch (obj->type) { case String: printf("node value> %s\n", ((LNodeString *)obj)->value); break; case Integer: printf("node value> %d\n", ((LNodeInteger *)obj)->value); break; default: printf("node value> empty node\n"); } obj = obj->next; } }