X-Git-Url: http://git.droids-corp.org/?p=protos%2Flibecoli.git;a=blobdiff_plain;f=src%2Fecoli_node_once.c;fp=src%2Fecoli_node_once.c;h=e3ed96a9889187e18f48c37a939cfc653a8a857c;hp=4662a66195913d72092d02649a8cdb6f889d79cc;hb=984760622f2c8472fd2667e24bcceb543bdb1aff;hpb=ae32f7f2fd1bc44a5388e1984f7c96bc29d3fdc2 diff --git a/src/ecoli_node_once.c b/src/ecoli_node_once.c index 4662a66..e3ed96a 100644 --- a/src/ecoli_node_once.c +++ b/src/ecoli_node_once.c @@ -29,18 +29,18 @@ struct ec_node_once { }; static unsigned int -count_node(struct ec_parse *parse, const struct ec_node *node) +count_node(struct ec_pnode *parse, const struct ec_node *node) { - struct ec_parse *child; + struct ec_pnode *child; unsigned int count = 0; if (parse == NULL) return 0; - if (ec_parse_get_node(parse) == node) + if (ec_pnode_get_node(parse) == node) count++; - EC_PARSE_FOREACH_CHILD(child, parse) + EC_PNODE_FOREACH_CHILD(child, parse) count += count_node(child, node); return count; @@ -48,7 +48,7 @@ count_node(struct ec_parse *parse, const struct ec_node *node) static int ec_node_once_parse(const struct ec_node *node, - struct ec_parse *state, + struct ec_pnode *state, const struct ec_strvec *strvec) { struct ec_node_once *priv = ec_node_priv(node); @@ -57,11 +57,11 @@ ec_node_once_parse(const struct ec_node *node, /* count the number of occurences of the node: if already parsed, * do not match */ - count = count_node(ec_parse_get_root(state), priv->child); + count = count_node(ec_pnode_get_root(state), priv->child); if (count > 0) return EC_PARSE_NOMATCH; - return ec_node_parse_child(priv->child, state, strvec); + return ec_parse_child(priv->child, state, strvec); } static int @@ -70,18 +70,18 @@ ec_node_once_complete(const struct ec_node *node, const struct ec_strvec *strvec) { struct ec_node_once *priv = ec_node_priv(node); - struct ec_parse *parse = ec_comp_get_state(comp); + struct ec_pnode *parse = ec_comp_get_state(comp); unsigned int count; int ret; /* count the number of occurences of the node: if already parsed, * do not match */ - count = count_node(ec_parse_get_root(parse), priv->child); + count = count_node(ec_pnode_get_root(parse), priv->child); if (count > 0) return 0; - ret = ec_node_complete_child(priv->child, comp, strvec); + ret = ec_complete_child(priv->child, comp, strvec); if (ret < 0) return ret; @@ -253,20 +253,20 @@ static int ec_node_once_testcase(void) testres |= EC_TEST_CHECK_PARSE(node, 0, "foox"); testres |= EC_TEST_CHECK_COMPLETE(node, - "", EC_NODE_ENDLIST, - "foo", "bar", EC_NODE_ENDLIST); + "", EC_VA_END, + "foo", "bar", EC_VA_END); testres |= EC_TEST_CHECK_COMPLETE(node, - "f", EC_NODE_ENDLIST, - "foo", EC_NODE_ENDLIST); + "f", EC_VA_END, + "foo", EC_VA_END); testres |= EC_TEST_CHECK_COMPLETE(node, - "b", EC_NODE_ENDLIST, - "bar", EC_NODE_ENDLIST); + "b", EC_VA_END, + "bar", EC_VA_END); testres |= EC_TEST_CHECK_COMPLETE(node, - "foo", "", EC_NODE_ENDLIST, - "bar", EC_NODE_ENDLIST); + "foo", "", EC_VA_END, + "bar", EC_VA_END); testres |= EC_TEST_CHECK_COMPLETE(node, - "bar", "", EC_NODE_ENDLIST, - "foo", "bar", EC_NODE_ENDLIST); + "bar", "", EC_VA_END, + "foo", "bar", EC_VA_END); ec_node_free(node); return testres;