new: ctx package list functions

This commit is contained in:
ngn
2024-08-04 18:59:30 +03:00
parent bb1f5a61b2
commit 73a1f997e6
5 changed files with 98 additions and 14 deletions

View File

@ -14,6 +14,13 @@ typedef struct lm_ctx {
const char *version; // libmp version (read-only)
} lm_ctx_t;
typedef struct lm_ctx_list {
lm_pool_t *head;
lm_pool_t *pool;
lm_pkg_t *pkg;
ssize_t count;
} lm_ctx_list_t;
typedef struct lm_ctx_resolve_list {
lm_pkg_t *resolving;
lm_pkg_t *packages;
@ -62,6 +69,10 @@ void lm_ctx_free(lm_ctx_t *ctx);
/* ####################
## main fucntions ##
#################### */
lm_ctx_list_t *lm_ctx_list(lm_ctx_t *ctx, lm_ctx_list_t *list); // returns the state of package list
lm_pkg_t *lm_ctx_list_next(lm_ctx_list_t *list); // returns the next package in the list
void lm_ctx_list_free(lm_ctx_list_t *list); // frees the package list state
lm_ctx_resolve_list_t *lm_ctx_resolve(
lm_ctx_t *ctx, lm_pkg_t *pkg, lm_ctx_resolve_list_t *list); // resolves a package and returns a list of packages
lm_pkg_t *lm_ctx_resolve_next(lm_ctx_resolve_list_t *list); // returns the next package in the list