1*a3cefe7fSPierre Pronchery 2*a3cefe7fSPierre Proncherylibpkgconf `tuple` module 3*a3cefe7fSPierre Pronchery========================= 4*a3cefe7fSPierre Pronchery 5*a3cefe7fSPierre ProncheryThe `tuple` module provides key-value mappings backed by a linked list. The key-value 6*a3cefe7fSPierre Proncherymapping is mainly used for variable substitution when parsing .pc files. 7*a3cefe7fSPierre Pronchery 8*a3cefe7fSPierre ProncheryThere are two sets of mappings: a ``pkgconf_pkg_t`` specific mapping, and a `global` mapping. 9*a3cefe7fSPierre ProncheryThe `tuple` module provides convenience wrappers for managing the `global` mapping, which is 10*a3cefe7fSPierre Proncheryattached to a given client object. 11*a3cefe7fSPierre Pronchery 12*a3cefe7fSPierre Pronchery.. c:function:: void pkgconf_tuple_add_global(pkgconf_client_t *client, const char *key, const char *value) 13*a3cefe7fSPierre Pronchery 14*a3cefe7fSPierre Pronchery Defines a global variable, replacing the previous declaration if one was set. 15*a3cefe7fSPierre Pronchery 16*a3cefe7fSPierre Pronchery :param pkgconf_client_t* client: The pkgconf client object to modify. 17*a3cefe7fSPierre Pronchery :param char* key: The key for the mapping (variable name). 18*a3cefe7fSPierre Pronchery :param char* value: The value for the mapped entry. 19*a3cefe7fSPierre Pronchery :return: nothing 20*a3cefe7fSPierre Pronchery 21*a3cefe7fSPierre Pronchery.. c:function:: void pkgconf_tuple_find_global(const pkgconf_client_t *client, const char *key) 22*a3cefe7fSPierre Pronchery 23*a3cefe7fSPierre Pronchery Looks up a global variable. 24*a3cefe7fSPierre Pronchery 25*a3cefe7fSPierre Pronchery :param pkgconf_client_t* client: The pkgconf client object to access. 26*a3cefe7fSPierre Pronchery :param char* key: The key or variable name to look up. 27*a3cefe7fSPierre Pronchery :return: the contents of the variable or ``NULL`` 28*a3cefe7fSPierre Pronchery :rtype: char * 29*a3cefe7fSPierre Pronchery 30*a3cefe7fSPierre Pronchery.. c:function:: void pkgconf_tuple_free_global(pkgconf_client_t *client) 31*a3cefe7fSPierre Pronchery 32*a3cefe7fSPierre Pronchery Delete all global variables associated with a pkgconf client object. 33*a3cefe7fSPierre Pronchery 34*a3cefe7fSPierre Pronchery :param pkgconf_client_t* client: The pkgconf client object to modify. 35*a3cefe7fSPierre Pronchery :return: nothing 36*a3cefe7fSPierre Pronchery 37*a3cefe7fSPierre Pronchery.. c:function:: void pkgconf_tuple_define_global(pkgconf_client_t *client, const char *kv) 38*a3cefe7fSPierre Pronchery 39*a3cefe7fSPierre Pronchery Parse and define a global variable. 40*a3cefe7fSPierre Pronchery 41*a3cefe7fSPierre Pronchery :param pkgconf_client_t* client: The pkgconf client object to modify. 42*a3cefe7fSPierre Pronchery :param char* kv: The variable in the form of ``key=value``. 43*a3cefe7fSPierre Pronchery :return: nothing 44*a3cefe7fSPierre Pronchery 45*a3cefe7fSPierre Pronchery.. c:function:: pkgconf_tuple_t *pkgconf_tuple_add(const pkgconf_client_t *client, pkgconf_list_t *list, const char *key, const char *value, bool parse) 46*a3cefe7fSPierre Pronchery 47*a3cefe7fSPierre Pronchery Optionally parse and then define a variable. 48*a3cefe7fSPierre Pronchery 49*a3cefe7fSPierre Pronchery :param pkgconf_client_t* client: The pkgconf client object to access. 50*a3cefe7fSPierre Pronchery :param pkgconf_list_t* list: The variable list to add the new variable to. 51*a3cefe7fSPierre Pronchery :param char* key: The name of the variable being added. 52*a3cefe7fSPierre Pronchery :param char* value: The value of the variable being added. 53*a3cefe7fSPierre Pronchery :param bool parse: Whether or not to parse the value for variable substitution. 54*a3cefe7fSPierre Pronchery :return: a variable object 55*a3cefe7fSPierre Pronchery :rtype: pkgconf_tuple_t * 56*a3cefe7fSPierre Pronchery 57*a3cefe7fSPierre Pronchery.. c:function:: char *pkgconf_tuple_find(const pkgconf_client_t *client, pkgconf_list_t *list, const char *key) 58*a3cefe7fSPierre Pronchery 59*a3cefe7fSPierre Pronchery Look up a variable in a variable list. 60*a3cefe7fSPierre Pronchery 61*a3cefe7fSPierre Pronchery :param pkgconf_client_t* client: The pkgconf client object to access. 62*a3cefe7fSPierre Pronchery :param pkgconf_list_t* list: The variable list to search. 63*a3cefe7fSPierre Pronchery :param char* key: The variable name to search for. 64*a3cefe7fSPierre Pronchery :return: the value of the variable or ``NULL`` 65*a3cefe7fSPierre Pronchery :rtype: char * 66*a3cefe7fSPierre Pronchery 67*a3cefe7fSPierre Pronchery.. c:function:: char *pkgconf_tuple_parse(const pkgconf_client_t *client, pkgconf_list_t *vars, const char *value, unsigned int flags) 68*a3cefe7fSPierre Pronchery 69*a3cefe7fSPierre Pronchery Parse an expression for variable substitution. 70*a3cefe7fSPierre Pronchery 71*a3cefe7fSPierre Pronchery :param pkgconf_client_t* client: The pkgconf client object to access. 72*a3cefe7fSPierre Pronchery :param pkgconf_list_t* list: The variable list to search for variables (along side the global variable list). 73*a3cefe7fSPierre Pronchery :param char* value: The ``key=value`` string to parse. 74*a3cefe7fSPierre Pronchery :param uint flags: Any flags to consider while parsing. 75*a3cefe7fSPierre Pronchery :return: the variable data with any variables substituted 76*a3cefe7fSPierre Pronchery :rtype: char * 77*a3cefe7fSPierre Pronchery 78*a3cefe7fSPierre Pronchery.. c:function:: void pkgconf_tuple_free_entry(pkgconf_tuple_t *tuple, pkgconf_list_t *list) 79*a3cefe7fSPierre Pronchery 80*a3cefe7fSPierre Pronchery Deletes a variable object, removing it from any variable lists and releasing any memory associated 81*a3cefe7fSPierre Pronchery with it. 82*a3cefe7fSPierre Pronchery 83*a3cefe7fSPierre Pronchery :param pkgconf_tuple_t* tuple: The variable object to release. 84*a3cefe7fSPierre Pronchery :param pkgconf_list_t* list: The variable list the variable object is attached to. 85*a3cefe7fSPierre Pronchery :return: nothing 86*a3cefe7fSPierre Pronchery 87*a3cefe7fSPierre Pronchery.. c:function:: void pkgconf_tuple_free(pkgconf_list_t *list) 88*a3cefe7fSPierre Pronchery 89*a3cefe7fSPierre Pronchery Deletes a variable list and any variables attached to it. 90*a3cefe7fSPierre Pronchery 91*a3cefe7fSPierre Pronchery :param pkgconf_list_t* list: The variable list to delete. 92*a3cefe7fSPierre Pronchery :return: nothing 93