remove smallest start from completed struct
[protos/libecoli.git] / lib / ecoli_completed.h
index 6da00af..d801c3e 100644 (file)
@@ -37,7 +37,7 @@ struct ec_node;
 enum ec_completed_type {
        EC_NO_MATCH,
        EC_MATCH,
-       EC_PARTIAL,
+       EC_PARTIAL_MATCH,
 };
 
 struct ec_completed_match {
@@ -46,7 +46,7 @@ struct ec_completed_match {
        const struct ec_node *node;
        char *add;
 
-       /* reverse order: [0] = last parsed, [len-1] = root */
+       /* reverse order: [0] = last, [len-1] = root */
        const struct ec_node **path;
        size_t pathlen;
 };
@@ -64,7 +64,6 @@ TAILQ_HEAD(ec_completed_node_list, ec_completed_node);
 struct ec_completed {
        unsigned count;
        unsigned count_match;
-       char *smallest_start;
        struct ec_completed_node_list nodes;
 };
 
@@ -88,12 +87,16 @@ struct ec_completed *ec_completed(void);
 int ec_completed_add_match(struct ec_completed *completed,
                        struct ec_parsed *state,
                        const struct ec_node *node, const char *add);
-int ec_completed_add_node(struct ec_completed *completed,
+int ec_completed_add_no_match(struct ec_completed *completed,
+                       struct ec_parsed *parsed_state,
                        const struct ec_node *node);
-int ec_completed_add_partial(struct ec_completed *completed,
+int ec_completed_add_partial_match(struct ec_completed *completed,
                        struct ec_parsed *state, const struct ec_node *node,
                        const char *add);
 
+int ec_completed_add_node(struct ec_completed *completed,
+                       const struct ec_node *node);
+
 void ec_completed_match_free(struct ec_completed_match *item);
 void ec_completed_free(struct ec_completed *completed);
 void ec_completed_dump(FILE *out,
@@ -104,9 +107,8 @@ ec_node_default_complete(const struct ec_node *gen_node,
                        struct ec_parsed *state,
                        const struct ec_strvec *strvec);
 
-/* cannot return NULL */
-const char *ec_completed_smallest_start(
-       const struct ec_completed *completed);
+/* return the smallest string start, or NULL on error */
+char *ec_completed_smallest_start(const struct ec_completed *completed);
 
 unsigned int ec_completed_count(
        const struct ec_completed *completed,