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
/**
* 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);
/**
* @}
......
......@@ -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.
......
......@@ -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()
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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);
......
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;
}
......
......@@ -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"
......
......@@ -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;
}
......
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