X-Git-Url: http://git.droids-corp.org/?p=protos%2Flibecoli.git;a=blobdiff_plain;f=examples%2Freadline%2Fmain.c;fp=examples%2Freadline%2Fmain.c;h=90a25f070ba477f72622333dab20e9d228477ecf;hp=6095808e662f01a230059a016901388e7699e9db;hb=984760622f2c8472fd2667e24bcceb543bdb1aff;hpb=ae32f7f2fd1bc44a5388e1984f7c96bc29d3fdc2 diff --git a/examples/readline/main.c b/examples/readline/main.c index 6095808..90a25f0 100644 --- a/examples/readline/main.c +++ b/examples/readline/main.c @@ -54,7 +54,7 @@ static char *my_completion_entry(const char *s, int state) return NULL; line[rl_point] = '\0'; - c = ec_node_complete(commands, line); + c = ec_complete(commands, line); free(line); if (c == NULL) return NULL; @@ -106,7 +106,7 @@ static char **my_attempted_completion(const char *text, int start, int end) static char *get_node_help(const struct ec_comp_item *item) { const struct ec_comp_group *grp; - const struct ec_parse *state; + const struct ec_pnode *state; const struct ec_node *node; char *help = NULL; const char *node_help = NULL; @@ -114,8 +114,8 @@ static char *get_node_help(const struct ec_comp_item *item) grp = ec_comp_item_get_grp(item); for (state = ec_comp_group_get_state(grp); state != NULL; - state = ec_parse_get_parent(state)) { - node = ec_parse_get_node(state); + state = ec_pnode_get_parent(state)) { + node = ec_pnode_get_node(state); if (node_help == NULL) node_help = ec_dict_get(ec_node_attrs(node), "help"); if (node_desc == NULL) @@ -139,7 +139,7 @@ static int show_help(int ignore, int invoking_key) const struct ec_comp_group *grp, *prev_grp = NULL; const struct ec_comp_item *item; struct ec_comp *c = NULL; - struct ec_parse *p = NULL; + struct ec_pnode *p = NULL; char *line = NULL; unsigned int count; char **helps = NULL; @@ -154,15 +154,15 @@ static int show_help(int ignore, int invoking_key) goto fail; /* check if the current line matches */ - p = ec_node_parse(commands, line); - if (ec_parse_matches(p)) + p = ec_parse(commands, line); + if (ec_pnode_matches(p)) match = 1; - ec_parse_free(p); + ec_pnode_free(p); p = NULL; /* complete at current cursor position */ line[rl_point] = '\0'; - c = ec_node_complete(commands, line); + c = ec_complete(commands, line); free(line); line = NULL; if (c == NULL) @@ -211,7 +211,7 @@ static int show_help(int ignore, int invoking_key) fail: ec_comp_iter_free(iter); - ec_parse_free(p); + ec_pnode_free(p); free(line); ec_comp_free(c); if (helps != NULL) { @@ -328,7 +328,7 @@ static int create_commands(void) int main(void) { - struct ec_parse *p; + struct ec_pnode *p; char *line; if (ec_init() < 0) { @@ -347,10 +347,10 @@ int main(void) if (line == NULL) break; - p = ec_node_parse(commands, line); - ec_parse_dump(stdout, p); + p = ec_parse(commands, line); + ec_pnode_dump(stdout, p); add_history(line); - ec_parse_free(p); + ec_pnode_free(p); }