From 8d4c44e8cc5d0a91f371401ca6e49f1e9bc45c98 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Fri, 17 Jun 2016 14:19:43 +0200 Subject: [PATCH] Fix Python module automatic code generation. --- coreapi/conference.h | 4 ++-- coreapi/friendlist.h | 4 ++-- coreapi/linphone_tunnel.h | 2 +- coreapi/linphonefriend.h | 6 +++--- coreapi/lpconfig.h | 4 ++-- coreapi/vcard.h | 10 +++++----- tools/genapixml.py | 6 +++--- .../apixml2python/handwritten_declarations.mustache | 4 ++-- .../apixml2python/handwritten_definitions.mustache | 10 +++++----- tools/python/apixml2python/linphone.py | 4 ++-- tools/python/apixml2python/linphone_module.mustache | 10 +++++----- 11 files changed, 32 insertions(+), 32 deletions(-) diff --git a/coreapi/conference.h b/coreapi/conference.h index 0de492b7e..b1867adee 100644 --- a/coreapi/conference.h +++ b/coreapi/conference.h @@ -97,12 +97,12 @@ LINPHONE_PUBLIC int linphone_conference_remove_participant(LinphoneConference *o /** * Get URIs of all participants of one conference - * The returned MSList contains URIs of all participant. That list must be + * The returned bctbx_list_t contains URIs of all participant. That list must be * freed after use and each URI must be unref with linphone_address_unref() * @param obj A #LinphoneConference * @return \mslist{LinphoneAddress} */ -LINPHONE_PUBLIC MSList *linphone_conference_get_participants(const LinphoneConference *obj); +LINPHONE_PUBLIC bctbx_list_t *linphone_conference_get_participants(const LinphoneConference *obj); /** * @} diff --git a/coreapi/friendlist.h b/coreapi/friendlist.h index 46bc711cd..1036acfbd 100644 --- a/coreapi/friendlist.h +++ b/coreapi/friendlist.h @@ -89,7 +89,7 @@ LINPHONE_PUBLIC void linphone_core_remove_friend_list(LinphoneCore *lc, Linphone * @param[in] lc LinphoneCore object * @return \mslist{LinphoneFriendList} a list of LinphoneFriendList */ -LINPHONE_PUBLIC const MSList * linphone_core_get_friends_lists(const LinphoneCore *lc); +LINPHONE_PUBLIC const bctbx_list_t * linphone_core_get_friends_lists(const LinphoneCore *lc); /** * Retrieves the first list of LinphoneFriend from the core. @@ -183,7 +183,7 @@ LINPHONE_PUBLIC LinphoneFriendListStatus linphone_friend_list_remove_friend(Linp * @param[in] list LinphoneFriendList object * @return \mslist{LinphoneFriend} a list of LinphoneFriend */ -LINPHONE_PUBLIC const MSList * linphone_friend_list_get_friends(const LinphoneFriendList *list); +LINPHONE_PUBLIC const bctbx_list_t * linphone_friend_list_get_friends(const LinphoneFriendList *list); /** * Find a friend in the friend list using a LinphoneAddress. diff --git a/coreapi/linphone_tunnel.h b/coreapi/linphone_tunnel.h index 6a52748c0..8b68651ea 100644 --- a/coreapi/linphone_tunnel.h +++ b/coreapi/linphone_tunnel.h @@ -229,7 +229,7 @@ LINPHONE_PUBLIC void linphone_tunnel_remove_server(LinphoneTunnel *tunnel, Linph * @param tunnel LinphoneTunnel object * @return \mslist{LinphoneTunnelConfig} */ -LINPHONE_PUBLIC const MSList *linphone_tunnel_get_servers(const LinphoneTunnel *tunnel); +LINPHONE_PUBLIC const bctbx_list_t *linphone_tunnel_get_servers(const LinphoneTunnel *tunnel); /** * Remove all tunnel server addresses previously entered with linphone_tunnel_add_server() diff --git a/coreapi/linphonefriend.h b/coreapi/linphonefriend.h index 1d52fc212..8067c8706 100644 --- a/coreapi/linphonefriend.h +++ b/coreapi/linphonefriend.h @@ -176,7 +176,7 @@ LINPHONE_PUBLIC void linphone_friend_add_address(LinphoneFriend *lf, const Linph * @param lf #LinphoneFriend object * @return \mslist{LinphoneAddress} */ -LINPHONE_PUBLIC MSList* linphone_friend_get_addresses(LinphoneFriend *lf); +LINPHONE_PUBLIC bctbx_list_t* linphone_friend_get_addresses(LinphoneFriend *lf); /** * Removes an address in this friend @@ -197,7 +197,7 @@ LINPHONE_PUBLIC void linphone_friend_add_phone_number(LinphoneFriend *lf, const * @param lf #LinphoneFriend object * @return \mslist{const char *} */ -LINPHONE_PUBLIC MSList* linphone_friend_get_phone_numbers(LinphoneFriend *lf); +LINPHONE_PUBLIC bctbx_list_t* linphone_friend_get_phone_numbers(LinphoneFriend *lf); /** * Removes a phone number in this friend @@ -430,7 +430,7 @@ LINPHONE_PUBLIC void linphone_core_reject_subscriber(LinphoneCore *lc, LinphoneF * @return \mslist{LinphoneFriend} * @deprecated use linphone_core_get_friends_lists() or linphone_friend_list_get_friends() instead. */ -LINPHONE_PUBLIC const MSList * linphone_core_get_friend_list(const LinphoneCore *lc); +LINPHONE_PUBLIC const bctbx_list_t * linphone_core_get_friend_list(const LinphoneCore *lc); /** * Notify all friends that have subscribed diff --git a/coreapi/lpconfig.h b/coreapi/lpconfig.h index c69f3d999..59269098e 100644 --- a/coreapi/lpconfig.h +++ b/coreapi/lpconfig.h @@ -114,7 +114,7 @@ LINPHONE_PUBLIC const char *lp_config_get_string(const LpConfig *lpconfig, const * @param[in] default_list \mslist{const char *} * @return \mslist{const char *} */ -LINPHONE_PUBLIC MSList * lp_config_get_string_list(const LpConfig *lpconfig, const char *section, const char *key, MSList *default_list); +LINPHONE_PUBLIC bctbx_list_t * lp_config_get_string_list(const LpConfig *lpconfig, const char *section, const char *key, bctbx_list_t *default_list); /** * Retrieves a configuration item as a range, given its section, key, and default min and max values. @@ -164,7 +164,7 @@ LINPHONE_PUBLIC void lp_config_set_string(LpConfig *lpconfig,const char *section * @param[in] key The name of the configuration item to set * @param[in] value \mslist{const char *} The value to set */ -LINPHONE_PUBLIC void lp_config_set_string_list(LpConfig *lpconfig, const char *section, const char *key, const MSList *value); +LINPHONE_PUBLIC void lp_config_set_string_list(LpConfig *lpconfig, const char *section, const char *key, const bctbx_list_t *value); /** * Sets a range config item diff --git a/coreapi/vcard.h b/coreapi/vcard.h index eb15ead51..dc0e6db3b 100644 --- a/coreapi/vcard.h +++ b/coreapi/vcard.h @@ -57,14 +57,14 @@ LINPHONE_PUBLIC void linphone_vcard_free(LinphoneVcard *vCard); * @param[in] file the path to the file to parse * @return \mslist{LinphoneVcard} */ -LINPHONE_PUBLIC MSList* linphone_vcard_list_from_vcard4_file(const char *file); +LINPHONE_PUBLIC bctbx_list_t* linphone_vcard_list_from_vcard4_file(const char *file); /** * Uses belcard to parse the content of a buffer and returns all the vcards it contains as LinphoneVcards, or NULL if it contains none. * @param[in] buffer the buffer to parse * @return \mslist{LinphoneVcard} */ -LINPHONE_PUBLIC MSList* linphone_vcard_list_from_vcard4_buffer(const char *buffer); +LINPHONE_PUBLIC bctbx_list_t* linphone_vcard_list_from_vcard4_buffer(const char *buffer); /** * Uses belcard to parse the content of a buffer and returns one vCard if possible, or NULL otherwise. @@ -120,7 +120,7 @@ void linphone_vcard_edit_main_sip_address(LinphoneVcard *vCard, const char *sip_ * @param[in] vCard the LinphoneVcard * @return \mslist{const char *} */ -LINPHONE_PUBLIC MSList* linphone_vcard_get_sip_addresses(const LinphoneVcard *vCard); +LINPHONE_PUBLIC bctbx_list_t* linphone_vcard_get_sip_addresses(const LinphoneVcard *vCard); /** * Adds a phone number in the vCard, using the TEL property @@ -141,14 +141,14 @@ void linphone_vcard_remove_phone_number(LinphoneVcard *vCard, const char *phone) * @param[in] vCard the LinphoneVcard * @return \mslist{const char *} */ -LINPHONE_PUBLIC MSList* linphone_vcard_get_phone_numbers(const LinphoneVcard *vCard); +LINPHONE_PUBLIC bctbx_list_t* linphone_vcard_get_phone_numbers(const LinphoneVcard *vCard); /** * Returns the list of SIP addresses (as string) in the vCard (all the IMPP attributes that has an URI value starting by "sip:") or NULL * @param[in] vCard the LinphoneVcard * @return \mslist{const char *} */ -LINPHONE_PUBLIC MSList* linphone_vcard_get_sip_addresses(const LinphoneVcard *vCard); +LINPHONE_PUBLIC bctbx_list_t* linphone_vcard_get_sip_addresses(const LinphoneVcard *vCard); /** * Fills the Organization field of the vCard diff --git a/tools/genapixml.py b/tools/genapixml.py index d03d96f54..f0bb2c51c 100755 --- a/tools/genapixml.py +++ b/tools/genapixml.py @@ -436,7 +436,7 @@ class Project: returnarg = CArgument(returntype, enums = self.enums, structs = self.__structs) returndesc = node.find("./detaileddescription/para/simplesect[@kind='return']") if returndesc is not None: - if returnarg.ctype == 'MSList': + if returnarg.ctype == 'MSList' or returnarg.ctype == 'bctbx_list_t': n = returndesc.find('.//mslist') if n is not None: returnarg.containedType = n.text @@ -507,7 +507,7 @@ class Project: returnarg = CArgument(t, enums = self.enums, structs = self.__structs) returndesc = node.find("./detaileddescription/para/simplesect[@kind='return']") if returndesc is not None: - if returnarg.ctype == 'MSList': + if returnarg.ctype == 'MSList' or returnarg.ctype == 'bctbx_list_t': n = returndesc.find('.//mslist') if n is not None: returnarg.containedType = n.text @@ -530,7 +530,7 @@ class Project: for arg in argslist.arguments: for paramdesc in paramdescs: if arg.name == paramdesc.find('./parameternamelist').find('./parametername').text: - if arg.ctype == 'MSList': + if arg.ctype == 'MSList' or arg.ctype == 'bctbx_list_t': n = paramdesc.find('.//mslist') if n is not None: arg.containedType = n.text diff --git a/tools/python/apixml2python/handwritten_declarations.mustache b/tools/python/apixml2python/handwritten_declarations.mustache index 0f694d6c3..ca7cfd1c4 100644 --- a/tools/python/apixml2python/handwritten_declarations.mustache +++ b/tools/python/apixml2python/handwritten_declarations.mustache @@ -24,8 +24,8 @@ typedef struct { LCSipTransports lcst; } pylinphone_SipTransportsObject; -PyObject * PyList_FromMSListOfString(const MSList *msl); -MSList * PyList_AsMSListOfString(PyObject *pyl); +PyObject * PyList_FromMSListOfString(const bctbx_list_t *msl); +bctbx_list_t * PyList_AsMSListOfString(PyObject *pyl); int PyLinphoneVideoSize_Check(PyObject *p); MSVideoSize PyLinphoneVideoSize_AsMSVideoSize(PyObject *obj); diff --git a/tools/python/apixml2python/handwritten_definitions.mustache b/tools/python/apixml2python/handwritten_definitions.mustache index e34c7f16b..f87dfe7f2 100644 --- a/tools/python/apixml2python/handwritten_definitions.mustache +++ b/tools/python/apixml2python/handwritten_definitions.mustache @@ -1,21 +1,21 @@ -PyObject * PyList_FromMSListOfString(const MSList *msl) { +PyObject * PyList_FromMSListOfString(const bctbx_list_t *msl) { PyObject *pyl = PyList_New(0); while (msl != NULL) { PyObject *item = Py_BuildValue("z", (const char *)msl->data); PyList_Append(pyl, item); - msl = ms_list_next(msl); + msl = bctbx_list_next(msl); } return pyl; } -MSList * PyList_AsMSListOfString(PyObject *pyl) { - MSList *msl = NULL; +bctbx_list_t * PyList_AsMSListOfString(PyObject *pyl) { + bctbx_list_t *msl = NULL; Py_ssize_t idx; Py_ssize_t size = PyList_Size(pyl); for (idx = 0; idx < size; idx++) { PyObject *item = PyList_GetItem(pyl, idx); char *citem = (char *)PyString_AsString(item); - msl = ms_list_append(msl, citem); + msl = bctbx_list_append(msl, citem); } return msl; } diff --git a/tools/python/apixml2python/linphone.py b/tools/python/apixml2python/linphone.py index a6456159b..0b3687129 100644 --- a/tools/python/apixml2python/linphone.py +++ b/tools/python/apixml2python/linphone.py @@ -101,7 +101,7 @@ class ArgumentType: self.use_native_pointer = False self.cast_convert_func_result = True self.__compute() - if self.basic_type == 'MSList' and self.contained_type is not None and self.contained_type != 'const char *': + if (self.basic_type == 'MSList' or self.basic_type == 'bctbx_list_t') and self.contained_type is not None and self.contained_type != 'const char *': self.linphone_module.mslist_types.add(self.contained_type) def __compute(self): @@ -214,7 +214,7 @@ class ArgumentType: self.fmt_str = 'O' self.cfmt_str = '%p' self.cnativefmt_str = '%ld' - elif self.basic_type == 'MSList': + elif self.basic_type == 'MSList' or self.basic_type == 'bctbx_list_t': if self.contained_type == 'const char *': self.type_str = 'list of string' self.convert_code = "{result_name}{result_suffix} = {cast}PyList_AsMSListOfString({arg_name});\n" diff --git a/tools/python/apixml2python/linphone_module.mustache b/tools/python/apixml2python/linphone_module.mustache index 9d5410979..7ee8443cb 100644 --- a/tools/python/apixml2python/linphone_module.mustache +++ b/tools/python/apixml2python/linphone_module.mustache @@ -72,25 +72,25 @@ static PyObject * pylinphone_{{class_name}}_instance_method_{{method_name}}(PyOb {{/classes}} {{#mslist_types}} -PyObject * PyList_FromMSListOf{{c_contained_type}}(const MSList *msl) { +PyObject * PyList_FromMSListOf{{c_contained_type}}(const bctbx_list_t *msl) { PyObject *pyl = PyList_New(0); while (msl != NULL) { {{c_contained_type}} *native_ptr = ({{c_contained_type}} *)msl->data; PyObject *item = pylinphone_{{python_contained_type}}_from_native_ptr(&pylinphone_{{python_contained_type}}Type, native_ptr); PyList_Append(pyl, item); - msl = ms_list_next(msl); + msl = bctbx_list_next(msl); } return pyl; } -MSList * PyList_AsMSListOf{{c_contained_type}}(PyObject *pyl) { - MSList *msl = NULL; +bctbx_list_t * PyList_AsMSListOf{{c_contained_type}}(PyObject *pyl) { + bctbx_list_t *msl = NULL; Py_ssize_t idx; Py_ssize_t size = PyList_Size(pyl); for (idx = 0; idx < size; idx++) { PyObject *item = PyList_GetItem(pyl, idx); {{c_contained_type}} *native_ptr = pylinphone_{{python_contained_type}}_get_native_ptr(item); - msl = ms_list_append(msl, native_ptr); + msl = bctbx_list_append(msl, native_ptr); } return msl; }