X-Git-Url: http://git.droids-corp.org/?p=protos%2Flibecoli.git;a=blobdiff_plain;f=include%2Fecoli_complete.h;fp=include%2Fecoli_complete.h;h=c36019ad3d1e820abd9905ef3978eacceb4f11a3;hp=ebb5ad0d074da28a23ecb25ed1fd77e6d4b6765a;hb=67b4d8d2b2593e3e64a848ce548bc0fd76bc440a;hpb=2d4aa6c1bf4bcd98e2686782c0462f82cd1cddde diff --git a/include/ecoli_complete.h b/include/ecoli_complete.h index ebb5ad0..c36019a 100644 --- a/include/ecoli_complete.h +++ b/include/ecoli_complete.h @@ -280,36 +280,53 @@ unsigned int ec_comp_count( * * */ -struct ec_comp_iter { - enum ec_comp_type type; - const struct ec_comp *comp; - struct ec_comp_group *cur_node; - struct ec_comp_item *cur_match; -}; /** + * Get the first completion item matching the type. * + * Also see EC_COMP_FOREACH(). * - * + * @param comp + * The completion list. + * @param type + * A logical OR of flags among EC_COMP_UNKNOWN, EC_COMP_PARTIAL and + * EC_COMP_FULL, to select the type to iterate. + * @return + * A completion item. */ -struct ec_comp_iter * -ec_comp_iter(const struct ec_comp *comp, - enum ec_comp_type type); +struct ec_comp_item * +ec_comp_iter_first(const struct ec_comp *comp, enum ec_comp_type type); /** + * Get the first completion item matching the type. * + * Also see EC_COMP_FOREACH(). * - * + * @param comp + * The completion list. + * @param type + * A logical OR of flags among EC_COMP_UNKNOWN, EC_COMP_PARTIAL and + * EC_COMP_FULL, to select the type to iterate. + * @return + * A completion item. */ -struct ec_comp_item *ec_comp_iter_next( - struct ec_comp_iter *iter); +struct ec_comp_item * +ec_comp_iter_next(struct ec_comp_item *item, enum ec_comp_type type); /** - * - * - * + * Iterate items matching a given type. + * + * @param item + * The item that will be set at each iteration. + * @param comp + * The completion list. + * @param type + * A logical OR of flags among EC_COMP_UNKNOWN, EC_COMP_PARTIAL and + * EC_COMP_FULL, to select the type to iterate. */ -void ec_comp_iter_free(struct ec_comp_iter *iter); - +#define EC_COMP_FOREACH(item, comp, type) \ + for (item = ec_comp_iter_first(comp, type); \ + item != NULL; \ + item = ec_comp_iter_next(item, type)) #endif