rename __ec_node
[protos/libecoli.git] / lib / ecoli_node_dynamic.c
index 1d11f1c..8a3edf3 100644 (file)
@@ -13,8 +13,8 @@
 #include <ecoli_strvec.h>
 #include <ecoli_keyval.h>
 #include <ecoli_node.h>
-#include <ecoli_parsed.h>
-#include <ecoli_completed.h>
+#include <ecoli_parse.h>
+#include <ecoli_complete.h>
 #include <ecoli_string.h>
 #include <ecoli_node_str.h>
 #include <ecoli_node_many.h>
@@ -31,7 +31,7 @@ struct ec_node_dynamic {
 
 static int
 ec_node_dynamic_parse(const struct ec_node *gen_node,
-               struct ec_parsed *parsed,
+               struct ec_parse *parse,
                const struct ec_strvec *strvec)
 {
        struct ec_node_dynamic *node = (struct ec_node_dynamic *)gen_node;
@@ -40,21 +40,21 @@ ec_node_dynamic_parse(const struct ec_node *gen_node,
        char key[64];
        int ret = -1;
 
-       child = node->build(parsed, node->opaque);
+       child = node->build(parse, node->opaque);
        if (child == NULL)
                goto fail;
 
        /* add the node pointer in the attributes, so it will be freed
-        * when parsed is freed */
+        * when parse is freed */
        snprintf(key, sizeof(key), "_dyn_%p", child);
-       ret = ec_keyval_set(ec_parsed_get_attrs(parsed), key, child,
+       ret = ec_keyval_set(ec_parse_get_attrs(parse), key, child,
                        (void *)node_free);
        if (ret < 0) {
                child = NULL; /* already freed */
                goto fail;
        }
 
-       return ec_node_parse_child(child, parsed, strvec);
+       return ec_node_parse_child(child, parse, strvec);
 
 fail:
        ec_node_free(child);
@@ -63,32 +63,32 @@ fail:
 
 static int
 ec_node_dynamic_complete(const struct ec_node *gen_node,
-               struct ec_completed *completed,
+               struct ec_comp *comp,
                const struct ec_strvec *strvec)
 {
        struct ec_node_dynamic *node = (struct ec_node_dynamic *)gen_node;
-       struct ec_parsed *parsed;
+       struct ec_parse *parse;
        struct ec_node *child = NULL;
        void (*node_free)(struct ec_node *) = ec_node_free;
        char key[64];
        int ret = -1;
 
-       parsed = ec_completed_get_state(completed);
-       child = node->build(parsed, node->opaque);
+       parse = ec_comp_get_state(comp);
+       child = node->build(parse, node->opaque);
        if (child == NULL)
                goto fail;
 
        /* add the node pointer in the attributes, so it will be freed
-        * when parsed is freed */
+        * when parse is freed */
        snprintf(key, sizeof(key), "_dyn_%p", child);
-       ret = ec_keyval_set(completed->attrs, key, child,
+       ret = ec_keyval_set(comp->attrs, key, child,
                        (void *)node_free);
        if (ret < 0) {
                child = NULL; /* already freed */
                goto fail;
        }
 
-       return ec_node_complete_child(child, completed, strvec);
+       return ec_node_complete_child(child, comp, strvec);
 
 fail:
        ec_node_free(child);
@@ -113,7 +113,7 @@ ec_node_dynamic(const char *id, ec_node_dynamic_build_t build, void *opaque)
                goto fail;
        }
 
-       gen_node = __ec_node(&ec_node_dynamic_type, id);
+       gen_node = ec_node_from_type(&ec_node_dynamic_type, id);
        if (gen_node == NULL)
                goto fail;
 
@@ -132,17 +132,17 @@ fail:
 EC_NODE_TYPE_REGISTER(ec_node_dynamic_type);
 
 static struct ec_node *
-build_counter(struct ec_parsed *parsed, void *opaque)
+build_counter(struct ec_parse *parse, void *opaque)
 {
        const struct ec_node *node;
-       struct ec_parsed *iter;
+       struct ec_parse *iter;
        unsigned int count = 0;
        char buf[32];
 
        (void)opaque;
-       for (iter = ec_parsed_get_root(parsed); iter != NULL;
-            iter = ec_parsed_iter_next(iter)) {
-               node = ec_parsed_get_node(iter);
+       for (iter = ec_parse_get_root(parse); iter != NULL;
+            iter = ec_parse_iter_next(iter)) {
+               node = ec_parse_get_node(iter);
                if (node->id && !strcmp(node->id, "my-id"))
                        count++;
        }