xref: /freebsd/contrib/pkgconf/doc/libpkgconf-dependency.rst (revision a3cefe7f2b4df0f70ff92d4570ce18e517af43ec)
1
2libpkgconf `dependency` module
3==============================
4
5The `dependency` module provides support for building `dependency lists` (the basic component of the overall `dependency graph`) and
6`dependency nodes` which store dependency information.
7
8.. c:function:: pkgconf_dependency_t *pkgconf_dependency_add(pkgconf_list_t *list, const char *package, const char *version, pkgconf_pkg_comparator_t compare)
9
10   Adds a parsed dependency to a dependency list as a dependency node.
11
12   :param pkgconf_client_t* client: The client object that owns the package this dependency list belongs to.
13   :param pkgconf_list_t* list: The dependency list to add a dependency node to.
14   :param char* package: The package `atom` to set on the dependency node.
15   :param char* version: The package `version` to set on the dependency node.
16   :param pkgconf_pkg_comparator_t compare: The comparison operator to set on the dependency node.
17   :param uint flags: Any flags to attach to the dependency node.
18   :return: A dependency node.
19   :rtype: pkgconf_dependency_t *
20
21.. c:function:: void pkgconf_dependency_append(pkgconf_list_t *list, pkgconf_dependency_t *tail)
22
23   Adds a dependency node to a pre-existing dependency list.
24
25   :param pkgconf_list_t* list: The dependency list to add a dependency node to.
26   :param pkgconf_dependency_t* tail: The dependency node to add to the tail of the dependency list.
27   :return: nothing
28
29.. c:function:: void pkgconf_dependency_free_one(pkgconf_dependency_t *dep)
30
31   Frees a dependency node.
32
33   :param pkgconf_dependency_t* dep: The dependency node to free.
34   :return: nothing
35
36.. c:function:: pkgconf_dependency_t *pkgconf_dependency_ref(pkgconf_client_t *owner, pkgconf_dependency_t *dep)
37
38   Increases a dependency node's refcount.
39
40   :param pkgconf_client_t* owner: The client object which owns the memory of this dependency node.
41   :param pkgconf_dependency_t* dep: The dependency to increase the refcount of.
42   :return: the dependency node on success, else NULL
43
44.. c:function:: void pkgconf_dependency_unref(pkgconf_client_t *owner, pkgconf_dependency_t *dep)
45
46   Decreases a dependency node's refcount and frees it if necessary.
47
48   :param pkgconf_client_t* owner: The client object which owns the memory of this dependency node.
49   :param pkgconf_dependency_t* dep: The dependency to decrease the refcount of.
50   :return: nothing
51
52.. c:function:: void pkgconf_dependency_free(pkgconf_list_t *list)
53
54   Release a dependency list and its child dependency nodes.
55
56   :param pkgconf_list_t* list: The dependency list to release.
57   :return: nothing
58
59.. c:function:: void pkgconf_dependency_parse_str(pkgconf_list_t *deplist_head, const char *depends)
60
61   Parse a dependency declaration into a dependency list.
62   Commas are counted as whitespace to allow for constructs such as ``@SUBSTVAR@, zlib`` being processed
63   into ``, zlib``.
64
65   :param pkgconf_client_t* client: The client object that owns the package this dependency list belongs to.
66   :param pkgconf_list_t* deplist_head: The dependency list to populate with dependency nodes.
67   :param char* depends: The dependency data to parse.
68   :param uint flags: Any flags to attach to the dependency nodes.
69   :return: nothing
70
71.. c:function:: void pkgconf_dependency_parse(const pkgconf_client_t *client, pkgconf_pkg_t *pkg, pkgconf_list_t *deplist, const char *depends)
72
73   Preprocess dependency data and then process that dependency declaration into a dependency list.
74   Commas are counted as whitespace to allow for constructs such as ``@SUBSTVAR@, zlib`` being processed
75   into ``, zlib``.
76
77   :param pkgconf_client_t* client: The client object that owns the package this dependency list belongs to.
78   :param pkgconf_pkg_t* pkg: The package object that owns this dependency list.
79   :param pkgconf_list_t* deplist: The dependency list to populate with dependency nodes.
80   :param char* depends: The dependency data to parse.
81   :param uint flags: Any flags to attach to the dependency nodes.
82   :return: nothing
83
84.. c:function:: pkgconf_dependency_t *pkgconf_dependency_copy(pkgconf_client_t *client, const pkgconf_dependency_t *dep)
85
86   Copies a dependency node to a new one.
87
88   :param pkgconf_client_t* client: The client object that will own this dependency.
89   :param pkgconf_dependency_t* dep: The dependency node to copy.
90   :return: a pointer to a new dependency node, else NULL
91