Commit 8d4c44e8 authored by Ghislain MARY's avatar Ghislain MARY

Fix Python module automatic code generation.

parent af2ecd8c
...@@ -97,12 +97,12 @@ LINPHONE_PUBLIC int linphone_conference_remove_participant(LinphoneConference *o ...@@ -97,12 +97,12 @@ LINPHONE_PUBLIC int linphone_conference_remove_participant(LinphoneConference *o
/** /**
* Get URIs of all participants of one conference * 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() * freed after use and each URI must be unref with linphone_address_unref()
* @param obj A #LinphoneConference * @param obj A #LinphoneConference
* @return \mslist{LinphoneAddress} * @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);
/** /**
* @} * @}
......
...@@ -89,7 +89,7 @@ LINPHONE_PUBLIC void linphone_core_remove_friend_list(LinphoneCore *lc, Linphone ...@@ -89,7 +89,7 @@ LINPHONE_PUBLIC void linphone_core_remove_friend_list(LinphoneCore *lc, Linphone
* @param[in] lc LinphoneCore object * @param[in] lc LinphoneCore object
* @return \mslist{LinphoneFriendList} a list of LinphoneFriendList * @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. * Retrieves the first list of LinphoneFriend from the core.
...@@ -183,7 +183,7 @@ LINPHONE_PUBLIC LinphoneFriendListStatus linphone_friend_list_remove_friend(Linp ...@@ -183,7 +183,7 @@ LINPHONE_PUBLIC LinphoneFriendListStatus linphone_friend_list_remove_friend(Linp
* @param[in] list LinphoneFriendList object * @param[in] list LinphoneFriendList object
* @return \mslist{LinphoneFriend} a list of LinphoneFriend * @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. * Find a friend in the friend list using a LinphoneAddress.
......
...@@ -229,7 +229,7 @@ LINPHONE_PUBLIC void linphone_tunnel_remove_server(LinphoneTunnel *tunnel, Linph ...@@ -229,7 +229,7 @@ LINPHONE_PUBLIC void linphone_tunnel_remove_server(LinphoneTunnel *tunnel, Linph
* @param tunnel LinphoneTunnel object * @param tunnel LinphoneTunnel object
* @return \mslist{LinphoneTunnelConfig} * @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() * Remove all tunnel server addresses previously entered with linphone_tunnel_add_server()
......
...@@ -176,7 +176,7 @@ LINPHONE_PUBLIC void linphone_friend_add_address(LinphoneFriend *lf, const Linph ...@@ -176,7 +176,7 @@ LINPHONE_PUBLIC void linphone_friend_add_address(LinphoneFriend *lf, const Linph
* @param lf #LinphoneFriend object * @param lf #LinphoneFriend object
* @return \mslist{LinphoneAddress} * @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 * Removes an address in this friend
...@@ -197,7 +197,7 @@ LINPHONE_PUBLIC void linphone_friend_add_phone_number(LinphoneFriend *lf, const ...@@ -197,7 +197,7 @@ LINPHONE_PUBLIC void linphone_friend_add_phone_number(LinphoneFriend *lf, const
* @param lf #LinphoneFriend object * @param lf #LinphoneFriend object
* @return \mslist{const char *} * @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 * Removes a phone number in this friend
...@@ -430,7 +430,7 @@ LINPHONE_PUBLIC void linphone_core_reject_subscriber(LinphoneCore *lc, LinphoneF ...@@ -430,7 +430,7 @@ LINPHONE_PUBLIC void linphone_core_reject_subscriber(LinphoneCore *lc, LinphoneF
* @return \mslist{LinphoneFriend} * @return \mslist{LinphoneFriend}
* @deprecated use linphone_core_get_friends_lists() or linphone_friend_list_get_friends() instead. * @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 * Notify all friends that have subscribed
......
...@@ -114,7 +114,7 @@ LINPHONE_PUBLIC const char *lp_config_get_string(const LpConfig *lpconfig, const ...@@ -114,7 +114,7 @@ LINPHONE_PUBLIC const char *lp_config_get_string(const LpConfig *lpconfig, const
* @param[in] default_list \mslist{const char *} * @param[in] default_list \mslist{const char *}
* @return \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. * 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 ...@@ -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] key The name of the configuration item to set
* @param[in] value \mslist{const char *} The value 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 * Sets a range config item
......
...@@ -57,14 +57,14 @@ LINPHONE_PUBLIC void linphone_vcard_free(LinphoneVcard *vCard); ...@@ -57,14 +57,14 @@ LINPHONE_PUBLIC void linphone_vcard_free(LinphoneVcard *vCard);
* @param[in] file the path to the file to parse * @param[in] file the path to the file to parse
* @return \mslist{LinphoneVcard} * @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. * 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 * @param[in] buffer the buffer to parse
* @return \mslist{LinphoneVcard} * @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. * 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_ ...@@ -120,7 +120,7 @@ void linphone_vcard_edit_main_sip_address(LinphoneVcard *vCard, const char *sip_
* @param[in] vCard the LinphoneVcard * @param[in] vCard the LinphoneVcard
* @return \mslist{const char *} * @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 * 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) ...@@ -141,14 +141,14 @@ void linphone_vcard_remove_phone_number(LinphoneVcard *vCard, const char *phone)
* @param[in] vCard the LinphoneVcard * @param[in] vCard the LinphoneVcard
* @return \mslist{const char *} * @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 * 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 * @param[in] vCard the LinphoneVcard
* @return \mslist{const char *} * @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 * Fills the Organization field of the vCard
......
...@@ -436,7 +436,7 @@ class Project: ...@@ -436,7 +436,7 @@ class Project:
returnarg = CArgument(returntype, enums = self.enums, structs = self.__structs) returnarg = CArgument(returntype, enums = self.enums, structs = self.__structs)
returndesc = node.find("./detaileddescription/para/simplesect[@kind='return']") returndesc = node.find("./detaileddescription/para/simplesect[@kind='return']")
if returndesc is not None: if returndesc is not None:
if returnarg.ctype == 'MSList': if returnarg.ctype == 'MSList' or returnarg.ctype == 'bctbx_list_t':
n = returndesc.find('.//mslist') n = returndesc.find('.//mslist')
if n is not None: if n is not None:
returnarg.containedType = n.text returnarg.containedType = n.text
...@@ -507,7 +507,7 @@ class Project: ...@@ -507,7 +507,7 @@ class Project:
returnarg = CArgument(t, enums = self.enums, structs = self.__structs) returnarg = CArgument(t, enums = self.enums, structs = self.__structs)
returndesc = node.find("./detaileddescription/para/simplesect[@kind='return']") returndesc = node.find("./detaileddescription/para/simplesect[@kind='return']")
if returndesc is not None: if returndesc is not None:
if returnarg.ctype == 'MSList': if returnarg.ctype == 'MSList' or returnarg.ctype == 'bctbx_list_t':
n = returndesc.find('.//mslist') n = returndesc.find('.//mslist')
if n is not None: if n is not None:
returnarg.containedType = n.text returnarg.containedType = n.text
...@@ -530,7 +530,7 @@ class Project: ...@@ -530,7 +530,7 @@ class Project:
for arg in argslist.arguments: for arg in argslist.arguments:
for paramdesc in paramdescs: for paramdesc in paramdescs:
if arg.name == paramdesc.find('./parameternamelist').find('./parametername').text: 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') n = paramdesc.find('.//mslist')
if n is not None: if n is not None:
arg.containedType = n.text arg.containedType = n.text
......
...@@ -24,8 +24,8 @@ typedef struct { ...@@ -24,8 +24,8 @@ typedef struct {
LCSipTransports lcst; LCSipTransports lcst;
} pylinphone_SipTransportsObject; } pylinphone_SipTransportsObject;
PyObject * PyList_FromMSListOfString(const MSList *msl); PyObject * PyList_FromMSListOfString(const bctbx_list_t *msl);
MSList * PyList_AsMSListOfString(PyObject *pyl); bctbx_list_t * PyList_AsMSListOfString(PyObject *pyl);
int PyLinphoneVideoSize_Check(PyObject *p); int PyLinphoneVideoSize_Check(PyObject *p);
MSVideoSize PyLinphoneVideoSize_AsMSVideoSize(PyObject *obj); MSVideoSize PyLinphoneVideoSize_AsMSVideoSize(PyObject *obj);
......
PyObject * PyList_FromMSListOfString(const MSList *msl) { PyObject * PyList_FromMSListOfString(const bctbx_list_t *msl) {
PyObject *pyl = PyList_New(0); PyObject *pyl = PyList_New(0);
while (msl != NULL) { while (msl != NULL) {
PyObject *item = Py_BuildValue("z", (const char *)msl->data); PyObject *item = Py_BuildValue("z", (const char *)msl->data);
PyList_Append(pyl, item); PyList_Append(pyl, item);
msl = ms_list_next(msl); msl = bctbx_list_next(msl);
} }
return pyl; return pyl;
} }
MSList * PyList_AsMSListOfString(PyObject *pyl) { bctbx_list_t * PyList_AsMSListOfString(PyObject *pyl) {
MSList *msl = NULL; bctbx_list_t *msl = NULL;
Py_ssize_t idx; Py_ssize_t idx;
Py_ssize_t size = PyList_Size(pyl); Py_ssize_t size = PyList_Size(pyl);
for (idx = 0; idx < size; idx++) { for (idx = 0; idx < size; idx++) {
PyObject *item = PyList_GetItem(pyl, idx); PyObject *item = PyList_GetItem(pyl, idx);
char *citem = (char *)PyString_AsString(item); char *citem = (char *)PyString_AsString(item);
msl = ms_list_append(msl, citem); msl = bctbx_list_append(msl, citem);
} }
return msl; return msl;
} }
......
...@@ -101,7 +101,7 @@ class ArgumentType: ...@@ -101,7 +101,7 @@ class ArgumentType:
self.use_native_pointer = False self.use_native_pointer = False
self.cast_convert_func_result = True self.cast_convert_func_result = True
self.__compute() 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) self.linphone_module.mslist_types.add(self.contained_type)
def __compute(self): def __compute(self):
...@@ -214,7 +214,7 @@ class ArgumentType: ...@@ -214,7 +214,7 @@ class ArgumentType:
self.fmt_str = 'O' self.fmt_str = 'O'
self.cfmt_str = '%p' self.cfmt_str = '%p'
self.cnativefmt_str = '%ld' 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 *': if self.contained_type == 'const char *':
self.type_str = 'list of string' self.type_str = 'list of string'
self.convert_code = "{result_name}{result_suffix} = {cast}PyList_AsMSListOfString({arg_name});\n" self.convert_code = "{result_name}{result_suffix} = {cast}PyList_AsMSListOfString({arg_name});\n"
......
...@@ -72,25 +72,25 @@ static PyObject * pylinphone_{{class_name}}_instance_method_{{method_name}}(PyOb ...@@ -72,25 +72,25 @@ static PyObject * pylinphone_{{class_name}}_instance_method_{{method_name}}(PyOb
{{/classes}} {{/classes}}
{{#mslist_types}} {{#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); PyObject *pyl = PyList_New(0);
while (msl != NULL) { while (msl != NULL) {
{{c_contained_type}} *native_ptr = ({{c_contained_type}} *)msl->data; {{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); PyObject *item = pylinphone_{{python_contained_type}}_from_native_ptr(&pylinphone_{{python_contained_type}}Type, native_ptr);
PyList_Append(pyl, item); PyList_Append(pyl, item);
msl = ms_list_next(msl); msl = bctbx_list_next(msl);
} }
return pyl; return pyl;
} }
MSList * PyList_AsMSListOf{{c_contained_type}}(PyObject *pyl) { bctbx_list_t * PyList_AsMSListOf{{c_contained_type}}(PyObject *pyl) {
MSList *msl = NULL; bctbx_list_t *msl = NULL;
Py_ssize_t idx; Py_ssize_t idx;
Py_ssize_t size = PyList_Size(pyl); Py_ssize_t size = PyList_Size(pyl);
for (idx = 0; idx < size; idx++) { for (idx = 0; idx < size; idx++) {
PyObject *item = PyList_GetItem(pyl, idx); PyObject *item = PyList_GetItem(pyl, idx);
{{c_contained_type}} *native_ptr = pylinphone_{{python_contained_type}}_get_native_ptr(item); {{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; return msl;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment