Split Python interface into libmu_py and c_api.so.
* include/mailutils/python.h: New file. * python/c_api: Rename to python/libmu_py.
Showing
45 changed files
with
613 additions
and
917 deletions
... | @@ -50,6 +50,7 @@ AC_SUBST(MU_LIB_SIEVE,'${top_builddir}/libmu_sieve/libmu_sieve.la') | ... | @@ -50,6 +50,7 @@ AC_SUBST(MU_LIB_SIEVE,'${top_builddir}/libmu_sieve/libmu_sieve.la') |
50 | AC_SUBST(MU_LIB_SCM,'${top_builddir}/libmu_scm/libmu_scm.la') | 50 | AC_SUBST(MU_LIB_SCM,'${top_builddir}/libmu_scm/libmu_scm.la') |
51 | AC_SUBST(MU_LIB_CPP,'${top_builddir}/libmu_cpp/libmu_cpp.la') | 51 | AC_SUBST(MU_LIB_CPP,'${top_builddir}/libmu_cpp/libmu_cpp.la') |
52 | AC_SUBST(MU_LIB_ARGP,'${top_builddir}/libmu_argp/libmu_argp.la') | 52 | AC_SUBST(MU_LIB_ARGP,'${top_builddir}/libmu_argp/libmu_argp.la') |
53 | AC_SUBST(MU_LIB_PY, '${top_builddir}/python/libmu_py/libmu_py.la') | ||
53 | 54 | ||
54 | dnl Other variables | 55 | dnl Other variables |
55 | AC_SUBST(SIEVE_MODDIR,'$(libdir)/$(PACKAGE)') | 56 | AC_SUBST(SIEVE_MODDIR,'$(libdir)/$(PACKAGE)') |
... | @@ -1104,9 +1105,11 @@ case "${withval}" in | ... | @@ -1104,9 +1105,11 @@ case "${withval}" in |
1104 | *) AC_MSG_ERROR(bad value ${withval} for --without-python) ;; | 1105 | *) AC_MSG_ERROR(bad value ${withval} for --without-python) ;; |
1105 | esac],[status_python=yes]) | 1106 | esac],[status_python=yes]) |
1106 | 1107 | ||
1108 | AC_SUBST(MU_PY) | ||
1107 | if test "$status_python" = yes; then | 1109 | if test "$status_python" = yes; then |
1108 | AM_PATH_PYTHON(2.5.0,, [status_python=no]) | 1110 | AM_PATH_PYTHON(2.5.0,, [status_python=no]) |
1109 | if test "$status_python" = yes; then | 1111 | if test "$status_python" = yes; then |
1112 | MU_PY=libmu_py.la | ||
1110 | AC_ARG_VAR([PYTHON_CONFIG], [The name of python-config binary]) | 1113 | AC_ARG_VAR([PYTHON_CONFIG], [The name of python-config binary]) |
1111 | AC_PATH_PROG([PYTHON_CONFIG], python-config) | 1114 | AC_PATH_PROG([PYTHON_CONFIG], python-config) |
1112 | if test -n "$PYTHON_CONFIG"; then | 1115 | if test -n "$PYTHON_CONFIG"; then |
... | @@ -1117,6 +1120,7 @@ if test "$status_python" = yes; then | ... | @@ -1117,6 +1120,7 @@ if test "$status_python" = yes; then |
1117 | fi | 1120 | fi |
1118 | 1121 | ||
1119 | if test "$status_python" = yes; then | 1122 | if test "$status_python" = yes; then |
1123 | AC_DEFINE(WITH_PYTHON,1,[Enable Python support]) | ||
1120 | AC_SUBST(MU_PYTHON_LTLIBS,'$(MU_PYTHON_LTLIBS)') | 1124 | AC_SUBST(MU_PYTHON_LTLIBS,'$(MU_PYTHON_LTLIBS)') |
1121 | fi | 1125 | fi |
1122 | fi | 1126 | fi |
... | @@ -1305,7 +1309,7 @@ AC_CONFIG_FILES([Makefile | ... | @@ -1305,7 +1309,7 @@ AC_CONFIG_FILES([Makefile |
1305 | pop3d/Makefile | 1309 | pop3d/Makefile |
1306 | pop3d/testsuite/Makefile | 1310 | pop3d/testsuite/Makefile |
1307 | python/Makefile | 1311 | python/Makefile |
1308 | python/c_api/Makefile | 1312 | python/libmu_py/Makefile |
1309 | python/mailutils/Makefile | 1313 | python/mailutils/Makefile |
1310 | readmsg/Makefile | 1314 | readmsg/Makefile |
1311 | readmsg/testsuite/Makefile | 1315 | readmsg/testsuite/Makefile | ... | ... |
include/mailutils/python.h
0 → 100644
1 | /* GNU Mailutils -- a suite of utilities for electronic mail | ||
2 | Copyright (C) 2009 Free Software Foundation, Inc. | ||
3 | |||
4 | This library is free software; you can redistribute it and/or | ||
5 | modify it under the terms of the GNU Lesser General Public | ||
6 | License as published by the Free Software Foundation; either | ||
7 | version 3 of the License, or (at your option) any later version. | ||
8 | |||
9 | This library is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
12 | Lesser General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU Lesser General | ||
15 | Public License along with this library; if not, write to the | ||
16 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
17 | Boston, MA 02110-1301 USA */ | ||
18 | |||
19 | #ifndef _MAILUTILS_PYTHON_H | ||
20 | #define _MAILUTILS_PYTHON_H | ||
21 | |||
22 | #include <Python.h> | ||
23 | |||
24 | #ifdef __cplusplus | ||
25 | extern "C" { | ||
26 | #endif | ||
27 | |||
28 | typedef struct { | ||
29 | PyObject_HEAD; | ||
30 | mu_address_t addr; | ||
31 | } PyAddress; | ||
32 | |||
33 | typedef struct { | ||
34 | PyObject_HEAD; | ||
35 | mu_attribute_t attr; | ||
36 | } PyAttribute; | ||
37 | |||
38 | typedef struct { | ||
39 | PyObject_HEAD; | ||
40 | mu_authority_t auth; | ||
41 | } PyAuthority; | ||
42 | |||
43 | typedef struct { | ||
44 | PyObject_HEAD; | ||
45 | mu_ticket_t ticket; | ||
46 | } PyTicket; | ||
47 | |||
48 | typedef struct { | ||
49 | PyObject_HEAD; | ||
50 | mu_wicket_t wicket; | ||
51 | } PyWicket; | ||
52 | |||
53 | typedef struct { | ||
54 | PyObject_HEAD; | ||
55 | struct mu_auth_data *auth_data; | ||
56 | } PyAuthData; | ||
57 | |||
58 | typedef struct { | ||
59 | PyObject_HEAD; | ||
60 | mu_body_t body; | ||
61 | } PyBody; | ||
62 | |||
63 | typedef struct { | ||
64 | PyObject_HEAD; | ||
65 | mu_debug_t dbg; | ||
66 | } PyDebug; | ||
67 | |||
68 | typedef struct { | ||
69 | PyObject_HEAD; | ||
70 | mu_envelope_t env; | ||
71 | } PyEnvelope; | ||
72 | |||
73 | typedef struct { | ||
74 | PyObject_HEAD; | ||
75 | mu_folder_t folder; | ||
76 | } PyFolder; | ||
77 | |||
78 | typedef struct { | ||
79 | PyObject_HEAD; | ||
80 | mu_header_t hdr; | ||
81 | } PyHeader; | ||
82 | |||
83 | typedef struct { | ||
84 | PyObject_HEAD; | ||
85 | mu_mailbox_t mbox; | ||
86 | } PyMailbox; | ||
87 | |||
88 | typedef struct { | ||
89 | PyObject_HEAD; | ||
90 | mu_mailcap_t mc; | ||
91 | } PyMailcap; | ||
92 | |||
93 | typedef struct { | ||
94 | PyObject_HEAD; | ||
95 | mu_mailcap_entry_t entry; | ||
96 | } PyMailcapEntry; | ||
97 | |||
98 | typedef struct { | ||
99 | PyObject_HEAD; | ||
100 | mu_mailer_t mlr; | ||
101 | } PyMailer; | ||
102 | |||
103 | typedef struct { | ||
104 | PyObject_HEAD; | ||
105 | mu_message_t msg; | ||
106 | } PyMessage; | ||
107 | |||
108 | typedef struct { | ||
109 | PyObject_HEAD; | ||
110 | mu_mime_t mime; | ||
111 | } PyMime; | ||
112 | |||
113 | typedef struct { | ||
114 | PyObject_HEAD; | ||
115 | mu_stream_t stm; | ||
116 | } PyStream; | ||
117 | |||
118 | typedef struct { | ||
119 | PyObject_HEAD; | ||
120 | mu_url_t url; | ||
121 | } PyUrl; | ||
122 | |||
123 | typedef int (*mulist_extractor_fp) (void *data, PyObject **dst); | ||
124 | |||
125 | extern void mu_py_init (void); | ||
126 | |||
127 | extern void mu_py_init_address (void); | ||
128 | extern void mu_py_init_attribute (void); | ||
129 | extern void mu_py_init_auth (void); | ||
130 | extern void mu_py_init_body (void); | ||
131 | extern void mu_py_init_debug (void); | ||
132 | extern void mu_py_init_envelope (void); | ||
133 | extern void mu_py_init_header (void); | ||
134 | extern void mu_py_init_folder (void); | ||
135 | extern void mu_py_init_mailer (void); | ||
136 | extern void mu_py_init_mailbox (void); | ||
137 | extern void mu_py_init_mailcap (void); | ||
138 | extern void mu_py_init_message (void); | ||
139 | extern void mu_py_init_mime (void); | ||
140 | extern void mu_py_init_stream (void); | ||
141 | extern void mu_py_init_url (void); | ||
142 | |||
143 | extern PyObject * mu_py_mulist_to_pylist (mu_list_t list, | ||
144 | mulist_extractor_fp fnc); | ||
145 | |||
146 | extern PyAttribute * PyAttribute_NEW (); | ||
147 | extern PyAddress * PyAddress_NEW (); | ||
148 | extern PyAuthority * PyAuthority_NEW (); | ||
149 | extern PyTicket * PyTicket_NEW (); | ||
150 | extern PyWicket * PyWicket_NEW (); | ||
151 | extern PyAuthData * PyAuthData_NEW (); | ||
152 | extern PyBody * PyBody_NEW (); | ||
153 | extern PyDebug * PyDebug_NEW (); | ||
154 | extern PyEnvelope * PyEnvelope_NEW (); | ||
155 | extern PyFolder * PyFolder_NEW (); | ||
156 | extern PyHeader * PyHeader_NEW (); | ||
157 | extern PyMailcap * PyMailcap_NEW (); | ||
158 | extern PyMailcapEntry * PyMailcapEntry_NEW (); | ||
159 | extern PyMailer * PyMailer_NEW (); | ||
160 | extern PyMessage * PyMessage_NEW (); | ||
161 | extern PyMime * PyMime_NEW (); | ||
162 | extern PyStream * PyStream_NEW (); | ||
163 | extern PyUrl * PyUrl_NEW (); | ||
164 | |||
165 | extern int PyAddress_Check (PyObject *x); | ||
166 | extern int PyAuthority_Check (PyObject *x); | ||
167 | extern int PyTicket_Check (PyObject *x); | ||
168 | extern int PyWicket_Check (PyObject *x); | ||
169 | extern int PyAuthData_Check (PyObject *x); | ||
170 | extern int PyMessage_Check (PyObject *x); | ||
171 | extern int PyStream_Check (PyObject *x); | ||
172 | |||
173 | #ifdef __cplusplus | ||
174 | } | ||
175 | #endif | ||
176 | |||
177 | #endif /* _MAILUTILS_PYTHON_H */ | ||
178 |
... | @@ -79,6 +79,9 @@ static struct mu_conf_option mu_conf_option[] = { | ... | @@ -79,6 +79,9 @@ static struct mu_conf_option mu_conf_option[] = { |
79 | #ifdef WITH_GUILE | 79 | #ifdef WITH_GUILE |
80 | { "WITH_GUILE", N_("Support for Guile as extension language") }, | 80 | { "WITH_GUILE", N_("Support for Guile as extension language") }, |
81 | #endif | 81 | #endif |
82 | #ifdef WITH_PYTHON | ||
83 | { "WITH_PYTHON", N_("Support for Python as extension language") }, | ||
84 | #endif | ||
82 | #ifdef WITH_PTHREAD | 85 | #ifdef WITH_PTHREAD |
83 | { "WITH_PTHREAD", N_("Support for POSIX threads") }, | 86 | { "WITH_PTHREAD", N_("Support for POSIX threads") }, |
84 | #endif | 87 | #endif | ... | ... |
python/c_api/address-private.h
deleted
100644 → 0
1 | /* | ||
2 | GNU Mailutils -- a suite of utilities for electronic mail | ||
3 | Copyright (C) 2009 Free Software Foundation, Inc. | ||
4 | |||
5 | This library is free software; you can redistribute it and/or | ||
6 | modify it under the terms of the GNU Lesser General Public | ||
7 | License as published by the Free Software Foundation; either | ||
8 | version 3 of the License, or (at your option) any later version. | ||
9 | |||
10 | This library is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Lesser General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Lesser General | ||
16 | Public License along with this library; if not, write to the | ||
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301 USA | ||
19 | */ | ||
20 | |||
21 | #ifndef _MUCAPI_ADDRESS_H | ||
22 | #define _MUCAPI_ADDRESS_H | ||
23 | |||
24 | #include <mailutils/address.h> | ||
25 | |||
26 | typedef struct { | ||
27 | PyObject_HEAD; | ||
28 | mu_address_t addr; | ||
29 | } PyAddress; | ||
30 | |||
31 | extern PyAddress * PyAddress_NEW (); | ||
32 | extern int PyAddress_Check (PyObject *x); | ||
33 | |||
34 | #endif /* not _MUCAPI_ADDRESS_H */ |
python/c_api/attribute-private.h
deleted
100644 → 0
1 | /* | ||
2 | GNU Mailutils -- a suite of utilities for electronic mail | ||
3 | Copyright (C) 2009 Free Software Foundation, Inc. | ||
4 | |||
5 | This library is free software; you can redistribute it and/or | ||
6 | modify it under the terms of the GNU Lesser General Public | ||
7 | License as published by the Free Software Foundation; either | ||
8 | version 3 of the License, or (at your option) any later version. | ||
9 | |||
10 | This library is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Lesser General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Lesser General | ||
16 | Public License along with this library; if not, write to the | ||
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301 USA | ||
19 | */ | ||
20 | |||
21 | #ifndef _MUCAPI_ATTRIBUTE_H | ||
22 | #define _MUCAPI_ATTRIBUTE_H | ||
23 | |||
24 | #include <mailutils/attribute.h> | ||
25 | |||
26 | typedef struct { | ||
27 | PyObject_HEAD; | ||
28 | mu_attribute_t attr; | ||
29 | } PyAttribute; | ||
30 | |||
31 | extern PyAttribute * PyAttribute_NEW (); | ||
32 | |||
33 | #endif /* not _MUCAPI_ATTRIBUTE_H */ |
python/c_api/auth-private.h
deleted
100644 → 0
1 | /* | ||
2 | GNU Mailutils -- a suite of utilities for electronic mail | ||
3 | Copyright (C) 2009 Free Software Foundation, Inc. | ||
4 | |||
5 | This library is free software; you can redistribute it and/or | ||
6 | modify it under the terms of the GNU Lesser General Public | ||
7 | License as published by the Free Software Foundation; either | ||
8 | version 3 of the License, or (at your option) any later version. | ||
9 | |||
10 | This library is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Lesser General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Lesser General | ||
16 | Public License along with this library; if not, write to the | ||
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301 USA | ||
19 | */ | ||
20 | |||
21 | #ifndef _MUCAPI_AUTH_H | ||
22 | #define _MUCAPI_AUTH_H | ||
23 | |||
24 | #include <mailutils/auth.h> | ||
25 | #include <mailutils/mu_auth.h> | ||
26 | |||
27 | typedef struct { | ||
28 | PyObject_HEAD; | ||
29 | mu_authority_t auth; | ||
30 | } PyAuthority; | ||
31 | |||
32 | typedef struct { | ||
33 | PyObject_HEAD; | ||
34 | mu_ticket_t ticket; | ||
35 | } PyTicket; | ||
36 | |||
37 | typedef struct { | ||
38 | PyObject_HEAD; | ||
39 | mu_wicket_t wicket; | ||
40 | } PyWicket; | ||
41 | |||
42 | typedef struct { | ||
43 | PyObject_HEAD; | ||
44 | struct mu_auth_data *auth_data; | ||
45 | } PyAuthData; | ||
46 | |||
47 | extern PyAuthority * PyAuthority_NEW (); | ||
48 | extern int PyAuthority_Check (PyObject *x); | ||
49 | |||
50 | extern PyTicket * PyTicket_NEW (); | ||
51 | extern int PyTicket_Check (PyObject *x); | ||
52 | |||
53 | extern PyWicket * PyWicket_NEW (); | ||
54 | extern int PyWicket_Check (PyObject *x); | ||
55 | |||
56 | extern PyAuthData * PyAuthData_NEW (); | ||
57 | extern int PyAuthData_Check (PyObject *x); | ||
58 | |||
59 | #endif /* not _MUCAPI_AUTH_H */ |
python/c_api/body-private.h
deleted
100644 → 0
1 | /* | ||
2 | GNU Mailutils -- a suite of utilities for electronic mail | ||
3 | Copyright (C) 2009 Free Software Foundation, Inc. | ||
4 | |||
5 | This library is free software; you can redistribute it and/or | ||
6 | modify it under the terms of the GNU Lesser General Public | ||
7 | License as published by the Free Software Foundation; either | ||
8 | version 3 of the License, or (at your option) any later version. | ||
9 | |||
10 | This library is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Lesser General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Lesser General | ||
16 | Public License along with this library; if not, write to the | ||
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301 USA | ||
19 | */ | ||
20 | |||
21 | #ifndef _MUCAPI_BODY_H | ||
22 | #define _MUCAPI_BODY_H | ||
23 | |||
24 | #include <mailutils/body.h> | ||
25 | |||
26 | typedef struct { | ||
27 | PyObject_HEAD; | ||
28 | mu_body_t body; | ||
29 | } PyBody; | ||
30 | |||
31 | extern PyBody * PyBody_NEW (); | ||
32 | |||
33 | #endif /* not _MUCAPI_BODY_H */ |
python/c_api/c_api.h
deleted
100644 → 0
1 | /* | ||
2 | GNU Mailutils -- a suite of utilities for electronic mail | ||
3 | Copyright (C) 2009 Free Software Foundation, Inc. | ||
4 | |||
5 | This library is free software; you can redistribute it and/or | ||
6 | modify it under the terms of the GNU Lesser General Public | ||
7 | License as published by the Free Software Foundation; either | ||
8 | version 3 of the License, or (at your option) any later version. | ||
9 | |||
10 | This library is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Lesser General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Lesser General | ||
16 | Public License along with this library; if not, write to the | ||
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301 USA | ||
19 | */ | ||
20 | |||
21 | #ifdef HAVE_CONFIG_H | ||
22 | # include <config.h> | ||
23 | #endif | ||
24 | |||
25 | #include <Python.h> | ||
26 | |||
27 | #define PY_PACKAGE_NAME "mailutils" | ||
28 | #define PY_ROOT_NAME "c_api" | ||
29 | #define PY_PACKAGE_VERSION PACKAGE_VERSION | ||
30 | |||
31 | extern inline PyObject * _ro (PyObject *obj); | ||
32 | extern void py_dealloc (PyObject *self); | ||
33 | extern PyObject * status_object (int status, PyObject *py_obj); | ||
34 | extern PyObject * attach_module (const char *name, PyMethodDef *methods); | ||
35 | |||
36 | extern void init_error (); | ||
37 | extern void init_address (); | ||
38 | extern void init_attribute (); | ||
39 | extern void init_auth (); | ||
40 | extern void init_body (); | ||
41 | extern void init_debug (); | ||
42 | extern void init_envelope (); | ||
43 | extern void init_header (); | ||
44 | extern void init_filter (); | ||
45 | extern void init_folder (); | ||
46 | extern void init_mailer (); | ||
47 | extern void init_mailbox (); | ||
48 | extern void init_mailcap (); | ||
49 | extern void init_message (); | ||
50 | extern void init_mime (); | ||
51 | extern void init_registrar (); | ||
52 | extern void init_stream (); | ||
53 | extern void init_url (); | ||
54 | extern void init_util (); |
python/c_api/debug-private.h
deleted
100644 → 0
1 | /* | ||
2 | GNU Mailutils -- a suite of utilities for electronic mail | ||
3 | Copyright (C) 2009 Free Software Foundation, Inc. | ||
4 | |||
5 | This library is free software; you can redistribute it and/or | ||
6 | modify it under the terms of the GNU Lesser General Public | ||
7 | License as published by the Free Software Foundation; either | ||
8 | version 3 of the License, or (at your option) any later version. | ||
9 | |||
10 | This library is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Lesser General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Lesser General | ||
16 | Public License along with this library; if not, write to the | ||
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301 USA | ||
19 | */ | ||
20 | |||
21 | #ifndef _MUCAPI_DEBUG_H | ||
22 | #define _MUCAPI_DEBUG_H | ||
23 | |||
24 | #include <mailutils/debug.h> | ||
25 | |||
26 | typedef struct { | ||
27 | PyObject_HEAD; | ||
28 | mu_debug_t dbg; | ||
29 | } PyDebug; | ||
30 | |||
31 | extern PyDebug * PyDebug_NEW (); | ||
32 | |||
33 | #endif /* not _MUCAPI_DEBUG_H */ |
python/c_api/envelope-private.h
deleted
100644 → 0
1 | /* | ||
2 | GNU Mailutils -- a suite of utilities for electronic mail | ||
3 | Copyright (C) 2009 Free Software Foundation, Inc. | ||
4 | |||
5 | This library is free software; you can redistribute it and/or | ||
6 | modify it under the terms of the GNU Lesser General Public | ||
7 | License as published by the Free Software Foundation; either | ||
8 | version 3 of the License, or (at your option) any later version. | ||
9 | |||
10 | This library is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Lesser General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Lesser General | ||
16 | Public License along with this library; if not, write to the | ||
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301 USA | ||
19 | */ | ||
20 | |||
21 | #ifndef _MUCAPI_ENVELOPE_H | ||
22 | #define _MUCAPI_ENVELOPE_H | ||
23 | |||
24 | #include <mailutils/envelope.h> | ||
25 | |||
26 | typedef struct { | ||
27 | PyObject_HEAD; | ||
28 | mu_envelope_t env; | ||
29 | } PyEnvelope; | ||
30 | |||
31 | extern PyEnvelope * PyEnvelope_NEW (); | ||
32 | |||
33 | #endif /* not _MUCAPI_ENVELOPE_H */ |
python/c_api/folder-private.h
deleted
100644 → 0
1 | /* | ||
2 | GNU Mailutils -- a suite of utilities for electronic mail | ||
3 | Copyright (C) 2009 Free Software Foundation, Inc. | ||
4 | |||
5 | This library is free software; you can redistribute it and/or | ||
6 | modify it under the terms of the GNU Lesser General Public | ||
7 | License as published by the Free Software Foundation; either | ||
8 | version 3 of the License, or (at your option) any later version. | ||
9 | |||
10 | This library is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Lesser General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Lesser General | ||
16 | Public License along with this library; if not, write to the | ||
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301 USA | ||
19 | */ | ||
20 | |||
21 | #ifndef _MUCAPI_FOLDER_H | ||
22 | #define _MUCAPI_FOLDER_H | ||
23 | |||
24 | #include <mailutils/folder.h> | ||
25 | |||
26 | typedef struct { | ||
27 | PyObject_HEAD; | ||
28 | mu_folder_t folder; | ||
29 | } PyFolder; | ||
30 | |||
31 | extern PyFolder * PyFolder_NEW (); | ||
32 | |||
33 | #endif /* not _MUCAPI_FOLDER_H */ |
python/c_api/header-private.h
deleted
100644 → 0
1 | /* | ||
2 | GNU Mailutils -- a suite of utilities for electronic mail | ||
3 | Copyright (C) 2009 Free Software Foundation, Inc. | ||
4 | |||
5 | This library is free software; you can redistribute it and/or | ||
6 | modify it under the terms of the GNU Lesser General Public | ||
7 | License as published by the Free Software Foundation; either | ||
8 | version 3 of the License, or (at your option) any later version. | ||
9 | |||
10 | This library is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Lesser General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Lesser General | ||
16 | Public License along with this library; if not, write to the | ||
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301 USA | ||
19 | */ | ||
20 | |||
21 | #ifndef _MUCAPI_HEADER_H | ||
22 | #define _MUCAPI_HEADER_H | ||
23 | |||
24 | #include <mailutils/header.h> | ||
25 | |||
26 | typedef struct { | ||
27 | PyObject_HEAD; | ||
28 | mu_header_t hdr; | ||
29 | } PyHeader; | ||
30 | |||
31 | extern PyHeader * PyHeader_NEW (); | ||
32 | |||
33 | #endif /* not _MUCAPI_HEADER_H */ |
python/c_api/mailbox-private.h
deleted
100644 → 0
1 | /* | ||
2 | GNU Mailutils -- a suite of utilities for electronic mail | ||
3 | Copyright (C) 2009 Free Software Foundation, Inc. | ||
4 | |||
5 | This library is free software; you can redistribute it and/or | ||
6 | modify it under the terms of the GNU Lesser General Public | ||
7 | License as published by the Free Software Foundation; either | ||
8 | version 3 of the License, or (at your option) any later version. | ||
9 | |||
10 | This library is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Lesser General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Lesser General | ||
16 | Public License along with this library; if not, write to the | ||
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301 USA | ||
19 | */ | ||
20 | |||
21 | #ifndef _MUCAPI_MAILBOX_H | ||
22 | #define _MUCAPI_MAILBOX_H | ||
23 | |||
24 | #include <mailutils/mailbox.h> | ||
25 | |||
26 | typedef struct { | ||
27 | PyObject_HEAD; | ||
28 | mu_mailbox_t mbox; | ||
29 | } PyMailbox; | ||
30 | |||
31 | #endif /* not _MUCAPI_MAILBOX_H */ |
python/c_api/mailcap-private.h
deleted
100644 → 0
1 | /* | ||
2 | GNU Mailutils -- a suite of utilities for electronic mail | ||
3 | Copyright (C) 2009 Free Software Foundation, Inc. | ||
4 | |||
5 | This library is free software; you can redistribute it and/or | ||
6 | modify it under the terms of the GNU Lesser General Public | ||
7 | License as published by the Free Software Foundation; either | ||
8 | version 3 of the License, or (at your option) any later version. | ||
9 | |||
10 | This library is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Lesser General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Lesser General | ||
16 | Public License along with this library; if not, write to the | ||
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301 USA | ||
19 | */ | ||
20 | |||
21 | #ifndef _MUCAPI_MAILCAP_H | ||
22 | #define _MUCAPI_MAILCAP_H | ||
23 | |||
24 | #include <mailutils/mailcap.h> | ||
25 | |||
26 | typedef struct { | ||
27 | PyObject_HEAD; | ||
28 | mu_mailcap_t mc; | ||
29 | } PyMailcap; | ||
30 | |||
31 | typedef struct { | ||
32 | PyObject_HEAD; | ||
33 | mu_mailcap_entry_t entry; | ||
34 | } PyMailcapEntry; | ||
35 | |||
36 | extern PyMailcap * PyMailcap_NEW (); | ||
37 | extern PyMailcapEntry * PyMailcapEntry_NEW (); | ||
38 | |||
39 | #endif /* not _MUCAPI_MAILCAP_H */ |
python/c_api/mailer-private.h
deleted
100644 → 0
1 | /* | ||
2 | GNU Mailutils -- a suite of utilities for electronic mail | ||
3 | Copyright (C) 2009 Free Software Foundation, Inc. | ||
4 | |||
5 | This library is free software; you can redistribute it and/or | ||
6 | modify it under the terms of the GNU Lesser General Public | ||
7 | License as published by the Free Software Foundation; either | ||
8 | version 3 of the License, or (at your option) any later version. | ||
9 | |||
10 | This library is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Lesser General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Lesser General | ||
16 | Public License along with this library; if not, write to the | ||
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301 USA | ||
19 | */ | ||
20 | |||
21 | #ifndef _MUCAPI_MAILER_H | ||
22 | #define _MUCAPI_MAILER_H | ||
23 | |||
24 | #include <mailutils/mailer.h> | ||
25 | |||
26 | typedef struct { | ||
27 | PyObject_HEAD; | ||
28 | mu_mailer_t mlr; | ||
29 | } PyMailer; | ||
30 | |||
31 | extern PyMailer * PyMailer_NEW (); | ||
32 | |||
33 | #endif /* not _MUCAPI_MAILER_H */ |
python/c_api/message-private.h
deleted
100644 → 0
1 | /* | ||
2 | GNU Mailutils -- a suite of utilities for electronic mail | ||
3 | Copyright (C) 2009 Free Software Foundation, Inc. | ||
4 | |||
5 | This library is free software; you can redistribute it and/or | ||
6 | modify it under the terms of the GNU Lesser General Public | ||
7 | License as published by the Free Software Foundation; either | ||
8 | version 3 of the License, or (at your option) any later version. | ||
9 | |||
10 | This library is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Lesser General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Lesser General | ||
16 | Public License along with this library; if not, write to the | ||
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301 USA | ||
19 | */ | ||
20 | |||
21 | #ifndef _MUCAPI_MESSAGE_H | ||
22 | #define _MUCAPI_MESSAGE_H | ||
23 | |||
24 | #include <mailutils/message.h> | ||
25 | |||
26 | typedef struct { | ||
27 | PyObject_HEAD; | ||
28 | mu_message_t msg; | ||
29 | } PyMessage; | ||
30 | |||
31 | extern PyMessage * PyMessage_NEW (); | ||
32 | extern int PyMessage_Check (PyObject *x); | ||
33 | |||
34 | #endif /* not _MUCAPI_MESSAGE_H */ |
python/c_api/mime-private.h
deleted
100644 → 0
1 | /* | ||
2 | GNU Mailutils -- a suite of utilities for electronic mail | ||
3 | Copyright (C) 2009 Free Software Foundation, Inc. | ||
4 | |||
5 | This library is free software; you can redistribute it and/or | ||
6 | modify it under the terms of the GNU Lesser General Public | ||
7 | License as published by the Free Software Foundation; either | ||
8 | version 3 of the License, or (at your option) any later version. | ||
9 | |||
10 | This library is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Lesser General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Lesser General | ||
16 | Public License along with this library; if not, write to the | ||
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301 USA | ||
19 | */ | ||
20 | |||
21 | #ifndef _MUCAPI_MIME_H | ||
22 | #define _MUCAPI_MIME_H | ||
23 | |||
24 | #include <mailutils/mime.h> | ||
25 | |||
26 | typedef struct { | ||
27 | PyObject_HEAD; | ||
28 | mu_mime_t mime; | ||
29 | } PyMime; | ||
30 | |||
31 | extern PyMime * PyMime_NEW (); | ||
32 | |||
33 | #endif /* not _MUCAPI_MIME_H */ |
python/c_api/stream-private.h
deleted
100644 → 0
1 | /* | ||
2 | GNU Mailutils -- a suite of utilities for electronic mail | ||
3 | Copyright (C) 2009 Free Software Foundation, Inc. | ||
4 | |||
5 | This library is free software; you can redistribute it and/or | ||
6 | modify it under the terms of the GNU Lesser General Public | ||
7 | License as published by the Free Software Foundation; either | ||
8 | version 3 of the License, or (at your option) any later version. | ||
9 | |||
10 | This library is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Lesser General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Lesser General | ||
16 | Public License along with this library; if not, write to the | ||
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301 USA | ||
19 | */ | ||
20 | |||
21 | #ifndef _MUCAPI_STREAM_H | ||
22 | #define _MUCAPI_STREAM_H | ||
23 | |||
24 | #include <mailutils/stream.h> | ||
25 | |||
26 | typedef struct { | ||
27 | PyObject_HEAD; | ||
28 | mu_stream_t stm; | ||
29 | } PyStream; | ||
30 | |||
31 | extern PyStream * PyStream_NEW (); | ||
32 | extern int PyStream_Check (PyObject *x); | ||
33 | |||
34 | #endif /* not _MUCAPI_STREAM_H */ |
python/c_api/url-private.h
deleted
100644 → 0
1 | /* | ||
2 | GNU Mailutils -- a suite of utilities for electronic mail | ||
3 | Copyright (C) 2009 Free Software Foundation, Inc. | ||
4 | |||
5 | This library is free software; you can redistribute it and/or | ||
6 | modify it under the terms of the GNU Lesser General Public | ||
7 | License as published by the Free Software Foundation; either | ||
8 | version 3 of the License, or (at your option) any later version. | ||
9 | |||
10 | This library is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Lesser General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Lesser General | ||
16 | Public License along with this library; if not, write to the | ||
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301 USA | ||
19 | */ | ||
20 | |||
21 | #ifndef _MUCAPI_URL_H | ||
22 | #define _MUCAPI_URL_H | ||
23 | |||
24 | #include <mailutils/url.h> | ||
25 | |||
26 | typedef struct { | ||
27 | PyObject_HEAD; | ||
28 | mu_url_t url; | ||
29 | } PyUrl; | ||
30 | |||
31 | extern PyUrl * PyUrl_NEW (); | ||
32 | |||
33 | #endif /* not _MUCAPI_URL_H */ |
... | @@ -19,59 +19,49 @@ | ... | @@ -19,59 +19,49 @@ |
19 | 19 | ||
20 | INCLUDES = @MU_COMMON_INCLUDES@ $(PYTHON_INCLUDES) | 20 | INCLUDES = @MU_COMMON_INCLUDES@ $(PYTHON_INCLUDES) |
21 | 21 | ||
22 | MU_PYTHON_LTLIBS = c_api.la | 22 | EXTRA_LTLIBRARIES = libmu_py.la c_api.la |
23 | EXTRA_LTLIBRARIES = c_api.la | ||
24 | pkgpyexec_LTLIBRARIES = @MU_PYTHON_LTLIBS@ | ||
25 | c_api_la_LDFLAGS = -avoid-version -module -rpath $(pkgpyexecdir) | ||
26 | c_api_la_LIBADD = $(PYTHON_LIBS) @MU_COMMON_LIBRARIES@ \ | ||
27 | ${MU_LIB_MBOX}\ | ||
28 | ${MU_LIB_IMAP}\ | ||
29 | ${MU_LIB_POP}\ | ||
30 | ${MU_LIB_NNTP}\ | ||
31 | ${MU_LIB_MH}\ | ||
32 | ${MU_LIB_MAILDIR}\ | ||
33 | ${MU_LIB_AUTH}\ | ||
34 | ${MU_LIB_MAILER}\ | ||
35 | @MU_AUTHLIBS@\ | ||
36 | ${MU_LIB_MAILUTILS} | ||
37 | 23 | ||
38 | c_api_la_SOURCES = \ | 24 | lib_LTLIBRARIES=@MU_PY@ |
39 | c_api.c \ | 25 | libmu_py_la_SOURCES = \ |
40 | c_api.h \ | ||
41 | error.c \ | 26 | error.c \ |
42 | address.c \ | 27 | address.c \ |
43 | address-private.h \ | ||
44 | attribute.c \ | 28 | attribute.c \ |
45 | attribute-private.h \ | ||
46 | auth.c \ | 29 | auth.c \ |
47 | auth-private.h \ | ||
48 | body.c \ | 30 | body.c \ |
49 | body-private.h \ | ||
50 | debug.c \ | 31 | debug.c \ |
51 | debug-private.h \ | ||
52 | envelope.c \ | 32 | envelope.c \ |
53 | envelope-private.h \ | ||
54 | filter.c \ | 33 | filter.c \ |
55 | folder.c \ | 34 | folder.c \ |
56 | folder-private.h \ | 35 | libmu_py.c \ |
36 | libmu_py.h \ | ||
57 | list.c \ | 37 | list.c \ |
58 | list-private.h \ | ||
59 | header.c \ | 38 | header.c \ |
60 | header-private.h \ | ||
61 | mailer.c \ | 39 | mailer.c \ |
62 | mailer-private.h \ | ||
63 | mailbox.c \ | 40 | mailbox.c \ |
64 | mailbox-private.h \ | ||
65 | mailcap.c \ | 41 | mailcap.c \ |
66 | mailcap-private.h \ | ||
67 | message.c \ | 42 | message.c \ |
68 | message-private.h \ | ||
69 | mime.c \ | 43 | mime.c \ |
70 | mime-private.h \ | ||
71 | stream.c \ | 44 | stream.c \ |
72 | stream-private.h \ | ||
73 | registrar.c \ | 45 | registrar.c \ |
74 | url.c \ | 46 | url.c \ |
75 | url-private.h \ | ||
76 | util.c | 47 | util.c |
48 | libmu_py_la_LDFLAGS = -rpath $(libdir) \ | ||
49 | -export-symbols-regex '^(mu_py_|Py).*' \ | ||
50 | -version-info @VI_CURRENT@:@VI_REVISION@:@VI_AGE@ | ||
51 | libmu_py_la_LIBADD = $(PYTHON_LIBS) @MU_COMMON_LIBRARIES@ \ | ||
52 | ${MU_LIB_MBOX}\ | ||
53 | ${MU_LIB_IMAP}\ | ||
54 | ${MU_LIB_POP}\ | ||
55 | ${MU_LIB_NNTP}\ | ||
56 | ${MU_LIB_MH}\ | ||
57 | ${MU_LIB_MAILDIR}\ | ||
58 | ${MU_LIB_AUTH}\ | ||
59 | ${MU_LIB_MAILER}\ | ||
60 | @MU_AUTHLIBS@\ | ||
61 | ${MU_LIB_MAILUTILS} | ||
77 | 62 | ||
63 | MU_PYTHON_LTLIBS = c_api.la | ||
64 | pkgpyexec_LTLIBRARIES = @MU_PYTHON_LTLIBS@ | ||
65 | c_api_la_LDFLAGS = -avoid-version -module -rpath $(pkgpyexecdir) | ||
66 | c_api_la_LIBADD = $(PYTHON_LIBS) ${MU_LIB_PY} | ||
67 | c_api_la_SOURCES = c_api.c | ... | ... |
... | @@ -18,8 +18,7 @@ | ... | @@ -18,8 +18,7 @@ |
18 | Boston, MA 02110-1301 USA | 18 | Boston, MA 02110-1301 USA |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include "c_api.h" | 21 | #include "libmu_py.h" |
22 | #include "address-private.h" | ||
23 | 22 | ||
24 | #define PY_MODULE "address" | 23 | #define PY_MODULE "address" |
25 | #define PY_CSNAME "AddressType" | 24 | #define PY_CSNAME "AddressType" |
... | @@ -38,7 +37,7 @@ static PyTypeObject PyAddressType = { | ... | @@ -38,7 +37,7 @@ static PyTypeObject PyAddressType = { |
38 | PY_MODULE "." PY_CSNAME, /* tp_name */ | 37 | PY_MODULE "." PY_CSNAME, /* tp_name */ |
39 | sizeof (PyAddress), /* tp_basicsize */ | 38 | sizeof (PyAddress), /* tp_basicsize */ |
40 | 0, /* tp_itemsize */ | 39 | 0, /* tp_itemsize */ |
41 | (destructor)py_dealloc, /* tp_dealloc */ | 40 | (destructor)_py_dealloc, /* tp_dealloc */ |
42 | 0, /* tp_print */ | 41 | 0, /* tp_print */ |
43 | 0, /* tp_getattr; __getattr__ */ | 42 | 0, /* tp_getattr; __getattr__ */ |
44 | 0, /* tp_setattr; __setattr__ */ | 43 | 0, /* tp_setattr; __setattr__ */ |
... | @@ -55,12 +54,12 @@ static PyTypeObject PyAddressType = { | ... | @@ -55,12 +54,12 @@ static PyTypeObject PyAddressType = { |
55 | 0, /* tp_as_buffer */ | 54 | 0, /* tp_as_buffer */ |
56 | Py_TPFLAGS_DEFAULT, /* tp_flags */ | 55 | Py_TPFLAGS_DEFAULT, /* tp_flags */ |
57 | "", /* tp_doc */ | 56 | "", /* tp_doc */ |
58 | 0, /* tp_traverse */ | 57 | 0, /* tp_traverse */ |
59 | 0, /* tp_clear */ | 58 | 0, /* tp_clear */ |
60 | 0, /* tp_richcompare */ | 59 | 0, /* tp_richcompare */ |
61 | 0, /* tp_weaklistoffset */ | 60 | 0, /* tp_weaklistoffset */ |
62 | 0, /* tp_iter */ | 61 | 0, /* tp_iter */ |
63 | 0, /* tp_iternext */ | 62 | 0, /* tp_iternext */ |
64 | 0, /* tp_methods */ | 63 | 0, /* tp_methods */ |
65 | 0, /* tp_members */ | 64 | 0, /* tp_members */ |
66 | 0, /* tp_getset */ | 65 | 0, /* tp_getset */ |
... | @@ -326,15 +325,18 @@ static PyMethodDef methods[] = { | ... | @@ -326,15 +325,18 @@ static PyMethodDef methods[] = { |
326 | }; | 325 | }; |
327 | 326 | ||
328 | void | 327 | void |
329 | init_address () | 328 | mu_py_init_address (void) |
330 | { | 329 | { |
331 | PyObject *m; | ||
332 | |||
333 | PyAddressType.tp_new = PyType_GenericNew; | 330 | PyAddressType.tp_new = PyType_GenericNew; |
334 | if (PyType_Ready (&PyAddressType) < 0) | 331 | if (PyType_Ready (&PyAddressType) < 0) |
335 | return; | 332 | return; |
333 | } | ||
336 | 334 | ||
337 | if ((m = attach_module (PY_MODULE, methods))) | 335 | void |
336 | _mu_py_attach_address (void) | ||
337 | { | ||
338 | PyObject *m; | ||
339 | if ((m = _mu_py_attach_module (PY_MODULE, methods))) | ||
338 | { | 340 | { |
339 | Py_INCREF (&PyAddressType); | 341 | Py_INCREF (&PyAddressType); |
340 | PyModule_AddObject (m, PY_CSNAME, (PyObject *)&PyAddressType); | 342 | PyModule_AddObject (m, PY_CSNAME, (PyObject *)&PyAddressType); | ... | ... |
... | @@ -18,8 +18,7 @@ | ... | @@ -18,8 +18,7 @@ |
18 | Boston, MA 02110-1301 USA | 18 | Boston, MA 02110-1301 USA |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include "c_api.h" | 21 | #include "libmu_py.h" |
22 | #include "attribute-private.h" | ||
23 | 22 | ||
24 | #define PY_MODULE "attribute" | 23 | #define PY_MODULE "attribute" |
25 | #define PY_CSNAME "AttributeType" | 24 | #define PY_CSNAME "AttributeType" |
... | @@ -38,7 +37,7 @@ static PyTypeObject PyAttributeType = { | ... | @@ -38,7 +37,7 @@ static PyTypeObject PyAttributeType = { |
38 | PY_MODULE "." PY_CSNAME, /* tp_name */ | 37 | PY_MODULE "." PY_CSNAME, /* tp_name */ |
39 | sizeof (PyAttribute), /* tp_basicsize */ | 38 | sizeof (PyAttribute), /* tp_basicsize */ |
40 | 0, /* tp_itemsize */ | 39 | 0, /* tp_itemsize */ |
41 | (destructor)py_dealloc, /* tp_dealloc */ | 40 | (destructor)_py_dealloc, /* tp_dealloc */ |
42 | 0, /* tp_print */ | 41 | 0, /* tp_print */ |
43 | 0, /* tp_getattr; __getattr__ */ | 42 | 0, /* tp_getattr; __getattr__ */ |
44 | 0, /* tp_setattr; __setattr__ */ | 43 | 0, /* tp_setattr; __setattr__ */ |
... | @@ -55,12 +54,12 @@ static PyTypeObject PyAttributeType = { | ... | @@ -55,12 +54,12 @@ static PyTypeObject PyAttributeType = { |
55 | 0, /* tp_as_buffer */ | 54 | 0, /* tp_as_buffer */ |
56 | Py_TPFLAGS_DEFAULT, /* tp_flags */ | 55 | Py_TPFLAGS_DEFAULT, /* tp_flags */ |
57 | "", /* tp_doc */ | 56 | "", /* tp_doc */ |
58 | 0, /* tp_traverse */ | 57 | 0, /* tp_traverse */ |
59 | 0, /* tp_clear */ | 58 | 0, /* tp_clear */ |
60 | 0, /* tp_richcompare */ | 59 | 0, /* tp_richcompare */ |
61 | 0, /* tp_weaklistoffset */ | 60 | 0, /* tp_weaklistoffset */ |
62 | 0, /* tp_iter */ | 61 | 0, /* tp_iter */ |
63 | 0, /* tp_iternext */ | 62 | 0, /* tp_iternext */ |
64 | 0, /* tp_methods */ | 63 | 0, /* tp_methods */ |
65 | 0, /* tp_members */ | 64 | 0, /* tp_members */ |
66 | 0, /* tp_getset */ | 65 | 0, /* tp_getset */ |
... | @@ -229,15 +228,18 @@ static PyMethodDef methods[] = { | ... | @@ -229,15 +228,18 @@ static PyMethodDef methods[] = { |
229 | }; | 228 | }; |
230 | 229 | ||
231 | void | 230 | void |
232 | init_attribute () | 231 | mu_py_init_attribute (void) |
233 | { | 232 | { |
234 | PyObject *m; | ||
235 | |||
236 | PyAttributeType.tp_new = PyType_GenericNew; | 233 | PyAttributeType.tp_new = PyType_GenericNew; |
237 | if (PyType_Ready (&PyAttributeType) < 0) | 234 | if (PyType_Ready (&PyAttributeType) < 0) |
238 | return; | 235 | return; |
236 | } | ||
239 | 237 | ||
240 | if ((m = attach_module (PY_MODULE, methods))) | 238 | void |
239 | _mu_py_attach_attribute (void) | ||
240 | { | ||
241 | PyObject *m; | ||
242 | if ((m = _mu_py_attach_module (PY_MODULE, methods))) | ||
241 | { | 243 | { |
242 | Py_INCREF (&PyAttributeType); | 244 | Py_INCREF (&PyAttributeType); |
243 | PyModule_AddObject (m, PY_CSNAME, (PyObject *)&PyAttributeType); | 245 | PyModule_AddObject (m, PY_CSNAME, (PyObject *)&PyAttributeType); | ... | ... |
... | @@ -18,8 +18,7 @@ | ... | @@ -18,8 +18,7 @@ |
18 | Boston, MA 02110-1301 USA | 18 | Boston, MA 02110-1301 USA |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include "c_api.h" | 21 | #include "libmu_py.h" |
22 | #include "auth-private.h" | ||
23 | 22 | ||
24 | #define PY_MODULE "auth" | 23 | #define PY_MODULE "auth" |
25 | #define PY_CSNAME1 "AuthorityType" | 24 | #define PY_CSNAME1 "AuthorityType" |
... | @@ -66,7 +65,7 @@ static PyTypeObject PyAuthorityType = { | ... | @@ -66,7 +65,7 @@ static PyTypeObject PyAuthorityType = { |
66 | PY_MODULE "." PY_CSNAME1, /* tp_name */ | 65 | PY_MODULE "." PY_CSNAME1, /* tp_name */ |
67 | sizeof (PyAuthority), /* tp_basicsize */ | 66 | sizeof (PyAuthority), /* tp_basicsize */ |
68 | 0, /* tp_itemsize */ | 67 | 0, /* tp_itemsize */ |
69 | (destructor)py_dealloc, /* tp_dealloc */ | 68 | (destructor)_py_dealloc, /* tp_dealloc */ |
70 | 0, /* tp_print */ | 69 | 0, /* tp_print */ |
71 | 0, /* tp_getattr; __getattr__ */ | 70 | 0, /* tp_getattr; __getattr__ */ |
72 | 0, /* tp_setattr; __setattr__ */ | 71 | 0, /* tp_setattr; __setattr__ */ |
... | @@ -83,12 +82,12 @@ static PyTypeObject PyAuthorityType = { | ... | @@ -83,12 +82,12 @@ static PyTypeObject PyAuthorityType = { |
83 | 0, /* tp_as_buffer */ | 82 | 0, /* tp_as_buffer */ |
84 | Py_TPFLAGS_DEFAULT, /* tp_flags */ | 83 | Py_TPFLAGS_DEFAULT, /* tp_flags */ |
85 | "", /* tp_doc */ | 84 | "", /* tp_doc */ |
86 | 0, /* tp_traverse */ | 85 | 0, /* tp_traverse */ |
87 | 0, /* tp_clear */ | 86 | 0, /* tp_clear */ |
88 | 0, /* tp_richcompare */ | 87 | 0, /* tp_richcompare */ |
89 | 0, /* tp_weaklistoffset */ | 88 | 0, /* tp_weaklistoffset */ |
90 | 0, /* tp_iter */ | 89 | 0, /* tp_iter */ |
91 | 0, /* tp_iternext */ | 90 | 0, /* tp_iternext */ |
92 | 0, /* tp_methods */ | 91 | 0, /* tp_methods */ |
93 | 0, /* tp_members */ | 92 | 0, /* tp_members */ |
94 | 0, /* tp_getset */ | 93 | 0, /* tp_getset */ |
... | @@ -108,7 +107,7 @@ static PyTypeObject PyTicketType = { | ... | @@ -108,7 +107,7 @@ static PyTypeObject PyTicketType = { |
108 | PY_MODULE "." PY_CSNAME2, /* tp_name */ | 107 | PY_MODULE "." PY_CSNAME2, /* tp_name */ |
109 | sizeof (PyTicket), /* tp_basicsize */ | 108 | sizeof (PyTicket), /* tp_basicsize */ |
110 | 0, /* tp_itemsize */ | 109 | 0, /* tp_itemsize */ |
111 | (destructor)py_dealloc, /* tp_dealloc */ | 110 | (destructor)_py_dealloc, /* tp_dealloc */ |
112 | 0, /* tp_print */ | 111 | 0, /* tp_print */ |
113 | 0, /* tp_getattr; __getattr__ */ | 112 | 0, /* tp_getattr; __getattr__ */ |
114 | 0, /* tp_setattr; __setattr__ */ | 113 | 0, /* tp_setattr; __setattr__ */ |
... | @@ -125,12 +124,12 @@ static PyTypeObject PyTicketType = { | ... | @@ -125,12 +124,12 @@ static PyTypeObject PyTicketType = { |
125 | 0, /* tp_as_buffer */ | 124 | 0, /* tp_as_buffer */ |
126 | Py_TPFLAGS_DEFAULT, /* tp_flags */ | 125 | Py_TPFLAGS_DEFAULT, /* tp_flags */ |
127 | "", /* tp_doc */ | 126 | "", /* tp_doc */ |
128 | 0, /* tp_traverse */ | 127 | 0, /* tp_traverse */ |
129 | 0, /* tp_clear */ | 128 | 0, /* tp_clear */ |
130 | 0, /* tp_richcompare */ | 129 | 0, /* tp_richcompare */ |
131 | 0, /* tp_weaklistoffset */ | 130 | 0, /* tp_weaklistoffset */ |
132 | 0, /* tp_iter */ | 131 | 0, /* tp_iter */ |
133 | 0, /* tp_iternext */ | 132 | 0, /* tp_iternext */ |
134 | 0, /* tp_methods */ | 133 | 0, /* tp_methods */ |
135 | 0, /* tp_members */ | 134 | 0, /* tp_members */ |
136 | 0, /* tp_getset */ | 135 | 0, /* tp_getset */ |
... | @@ -150,7 +149,7 @@ static PyTypeObject PyWicketType = { | ... | @@ -150,7 +149,7 @@ static PyTypeObject PyWicketType = { |
150 | PY_MODULE "." PY_CSNAME3, /* tp_name */ | 149 | PY_MODULE "." PY_CSNAME3, /* tp_name */ |
151 | sizeof (PyWicket), /* tp_basicsize */ | 150 | sizeof (PyWicket), /* tp_basicsize */ |
152 | 0, /* tp_itemsize */ | 151 | 0, /* tp_itemsize */ |
153 | (destructor)py_dealloc, /* tp_dealloc */ | 152 | (destructor)_py_dealloc, /* tp_dealloc */ |
154 | 0, /* tp_print */ | 153 | 0, /* tp_print */ |
155 | 0, /* tp_getattr; __getattr__ */ | 154 | 0, /* tp_getattr; __getattr__ */ |
156 | 0, /* tp_setattr; __setattr__ */ | 155 | 0, /* tp_setattr; __setattr__ */ |
... | @@ -167,12 +166,12 @@ static PyTypeObject PyWicketType = { | ... | @@ -167,12 +166,12 @@ static PyTypeObject PyWicketType = { |
167 | 0, /* tp_as_buffer */ | 166 | 0, /* tp_as_buffer */ |
168 | Py_TPFLAGS_DEFAULT, /* tp_flags */ | 167 | Py_TPFLAGS_DEFAULT, /* tp_flags */ |
169 | "", /* tp_doc */ | 168 | "", /* tp_doc */ |
170 | 0, /* tp_traverse */ | 169 | 0, /* tp_traverse */ |
171 | 0, /* tp_clear */ | 170 | 0, /* tp_clear */ |
172 | 0, /* tp_richcompare */ | 171 | 0, /* tp_richcompare */ |
173 | 0, /* tp_weaklistoffset */ | 172 | 0, /* tp_weaklistoffset */ |
174 | 0, /* tp_iter */ | 173 | 0, /* tp_iter */ |
175 | 0, /* tp_iternext */ | 174 | 0, /* tp_iternext */ |
176 | 0, /* tp_methods */ | 175 | 0, /* tp_methods */ |
177 | 0, /* tp_members */ | 176 | 0, /* tp_members */ |
178 | 0, /* tp_getset */ | 177 | 0, /* tp_getset */ |
... | @@ -266,12 +265,12 @@ static PyTypeObject PyAuthDataType = { | ... | @@ -266,12 +265,12 @@ static PyTypeObject PyAuthDataType = { |
266 | 0, /* tp_as_buffer */ | 265 | 0, /* tp_as_buffer */ |
267 | Py_TPFLAGS_DEFAULT, /* tp_flags */ | 266 | Py_TPFLAGS_DEFAULT, /* tp_flags */ |
268 | "", /* tp_doc */ | 267 | "", /* tp_doc */ |
269 | 0, /* tp_traverse */ | 268 | 0, /* tp_traverse */ |
270 | 0, /* tp_clear */ | 269 | 0, /* tp_clear */ |
271 | 0, /* tp_richcompare */ | 270 | 0, /* tp_richcompare */ |
272 | 0, /* tp_weaklistoffset */ | 271 | 0, /* tp_weaklistoffset */ |
273 | 0, /* tp_iter */ | 272 | 0, /* tp_iter */ |
274 | 0, /* tp_iternext */ | 273 | 0, /* tp_iternext */ |
275 | 0, /* tp_methods */ | 274 | 0, /* tp_methods */ |
276 | 0, /* tp_members */ | 275 | 0, /* tp_members */ |
277 | 0, /* tp_getset */ | 276 | 0, /* tp_getset */ |
... | @@ -668,10 +667,8 @@ static PyMethodDef methods[] = { | ... | @@ -668,10 +667,8 @@ static PyMethodDef methods[] = { |
668 | }; | 667 | }; |
669 | 668 | ||
670 | void | 669 | void |
671 | init_auth () | 670 | mu_py_init_auth (void) |
672 | { | 671 | { |
673 | PyObject *m; | ||
674 | |||
675 | PyAuthorityType.tp_new = PyType_GenericNew; | 672 | PyAuthorityType.tp_new = PyType_GenericNew; |
676 | PyTicketType.tp_new = PyType_GenericNew; | 673 | PyTicketType.tp_new = PyType_GenericNew; |
677 | PyWicketType.tp_new = PyType_GenericNew; | 674 | PyWicketType.tp_new = PyType_GenericNew; |
... | @@ -685,8 +682,13 @@ init_auth () | ... | @@ -685,8 +682,13 @@ init_auth () |
685 | return; | 682 | return; |
686 | if (PyType_Ready (&PyAuthDataType) < 0) | 683 | if (PyType_Ready (&PyAuthDataType) < 0) |
687 | return; | 684 | return; |
685 | } | ||
688 | 686 | ||
689 | if ((m = attach_module (PY_MODULE, methods))) | 687 | void |
688 | _mu_py_attach_auth (void) | ||
689 | { | ||
690 | PyObject *m; | ||
691 | if ((m = _mu_py_attach_module (PY_MODULE, methods))) | ||
690 | { | 692 | { |
691 | Py_INCREF (&PyAuthorityType); | 693 | Py_INCREF (&PyAuthorityType); |
692 | Py_INCREF (&PyTicketType); | 694 | Py_INCREF (&PyTicketType); | ... | ... |
... | @@ -18,9 +18,7 @@ | ... | @@ -18,9 +18,7 @@ |
18 | Boston, MA 02110-1301 USA | 18 | Boston, MA 02110-1301 USA |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include "c_api.h" | 21 | #include "libmu_py.h" |
22 | #include "body-private.h" | ||
23 | #include "stream-private.h" | ||
24 | 22 | ||
25 | #define PY_MODULE "body" | 23 | #define PY_MODULE "body" |
26 | #define PY_CSNAME "BodyType" | 24 | #define PY_CSNAME "BodyType" |
... | @@ -39,7 +37,7 @@ static PyTypeObject PyBodyType = { | ... | @@ -39,7 +37,7 @@ static PyTypeObject PyBodyType = { |
39 | PY_MODULE "." PY_CSNAME, /* tp_name */ | 37 | PY_MODULE "." PY_CSNAME, /* tp_name */ |
40 | sizeof (PyBody), /* tp_basicsize */ | 38 | sizeof (PyBody), /* tp_basicsize */ |
41 | 0, /* tp_itemsize */ | 39 | 0, /* tp_itemsize */ |
42 | (destructor)py_dealloc, /* tp_dealloc */ | 40 | (destructor)_py_dealloc, /* tp_dealloc */ |
43 | 0, /* tp_print */ | 41 | 0, /* tp_print */ |
44 | 0, /* tp_getattr; __getattr__ */ | 42 | 0, /* tp_getattr; __getattr__ */ |
45 | 0, /* tp_setattr; __setattr__ */ | 43 | 0, /* tp_setattr; __setattr__ */ |
... | @@ -56,12 +54,12 @@ static PyTypeObject PyBodyType = { | ... | @@ -56,12 +54,12 @@ static PyTypeObject PyBodyType = { |
56 | 0, /* tp_as_buffer */ | 54 | 0, /* tp_as_buffer */ |
57 | Py_TPFLAGS_DEFAULT, /* tp_flags */ | 55 | Py_TPFLAGS_DEFAULT, /* tp_flags */ |
58 | "", /* tp_doc */ | 56 | "", /* tp_doc */ |
59 | 0, /* tp_traverse */ | 57 | 0, /* tp_traverse */ |
60 | 0, /* tp_clear */ | 58 | 0, /* tp_clear */ |
61 | 0, /* tp_richcompare */ | 59 | 0, /* tp_richcompare */ |
62 | 0, /* tp_weaklistoffset */ | 60 | 0, /* tp_weaklistoffset */ |
63 | 0, /* tp_iter */ | 61 | 0, /* tp_iter */ |
64 | 0, /* tp_iternext */ | 62 | 0, /* tp_iternext */ |
65 | 0, /* tp_methods */ | 63 | 0, /* tp_methods */ |
66 | 0, /* tp_members */ | 64 | 0, /* tp_members */ |
67 | 0, /* tp_getset */ | 65 | 0, /* tp_getset */ |
... | @@ -140,15 +138,18 @@ static PyMethodDef methods[] = { | ... | @@ -140,15 +138,18 @@ static PyMethodDef methods[] = { |
140 | }; | 138 | }; |
141 | 139 | ||
142 | void | 140 | void |
143 | init_body () | 141 | mu_py_init_body (void) |
144 | { | 142 | { |
145 | PyObject *m; | ||
146 | |||
147 | PyBodyType.tp_new = PyType_GenericNew; | 143 | PyBodyType.tp_new = PyType_GenericNew; |
148 | if (PyType_Ready (&PyBodyType) < 0) | 144 | if (PyType_Ready (&PyBodyType) < 0) |
149 | return; | 145 | return; |
146 | } | ||
150 | 147 | ||
151 | if ((m = attach_module (PY_MODULE, methods))) | 148 | void |
149 | _mu_py_attach_body (void) | ||
150 | { | ||
151 | PyObject *m; | ||
152 | if ((m = _mu_py_attach_module (PY_MODULE, methods))) | ||
152 | { | 153 | { |
153 | Py_INCREF (&PyBodyType); | 154 | Py_INCREF (&PyBodyType); |
154 | PyModule_AddObject (m, PY_CSNAME, (PyObject *)&PyBodyType); | 155 | PyModule_AddObject (m, PY_CSNAME, (PyObject *)&PyBodyType); | ... | ... |
... | @@ -18,13 +18,11 @@ | ... | @@ -18,13 +18,11 @@ |
18 | Boston, MA 02110-1301 USA | 18 | Boston, MA 02110-1301 USA |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #ifndef _MUCAPI_LIST_H | 21 | #include "libmu_py.h" |
22 | #define _MUCAPI_LIST_H | 22 | |
23 | 23 | PyMODINIT_FUNC | |
24 | #include <mailutils/list.h> | 24 | initc_api (void) |
25 | 25 | { | |
26 | typedef int (*mulist_extractor_fp) (void *data, PyObject **dst); | 26 | mu_py_init (); |
27 | 27 | mu_py_attach_modules (); | |
28 | extern PyObject * mulist_to_pylist (mu_list_t list, mulist_extractor_fp fnc); | 28 | } |
29 | |||
30 | #endif /* not _MUCAPI_LIST_H */ | ... | ... |
... | @@ -18,8 +18,7 @@ | ... | @@ -18,8 +18,7 @@ |
18 | Boston, MA 02110-1301 USA | 18 | Boston, MA 02110-1301 USA |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include "c_api.h" | 21 | #include "libmu_py.h" |
22 | #include "debug-private.h" | ||
23 | 22 | ||
24 | #define PY_MODULE "debug" | 23 | #define PY_MODULE "debug" |
25 | #define PY_CSNAME "DebugType" | 24 | #define PY_CSNAME "DebugType" |
... | @@ -38,7 +37,7 @@ static PyTypeObject PyDebugType = { | ... | @@ -38,7 +37,7 @@ static PyTypeObject PyDebugType = { |
38 | PY_MODULE "." PY_CSNAME, /* tp_name */ | 37 | PY_MODULE "." PY_CSNAME, /* tp_name */ |
39 | sizeof (PyDebug), /* tp_basicsize */ | 38 | sizeof (PyDebug), /* tp_basicsize */ |
40 | 0, /* tp_itemsize */ | 39 | 0, /* tp_itemsize */ |
41 | (destructor)py_dealloc, /* tp_dealloc */ | 40 | (destructor)_py_dealloc, /* tp_dealloc */ |
42 | 0, /* tp_print */ | 41 | 0, /* tp_print */ |
43 | 0, /* tp_getattr; __getattr__ */ | 42 | 0, /* tp_getattr; __getattr__ */ |
44 | 0, /* tp_setattr; __setattr__ */ | 43 | 0, /* tp_setattr; __setattr__ */ |
... | @@ -55,12 +54,12 @@ static PyTypeObject PyDebugType = { | ... | @@ -55,12 +54,12 @@ static PyTypeObject PyDebugType = { |
55 | 0, /* tp_as_buffer */ | 54 | 0, /* tp_as_buffer */ |
56 | Py_TPFLAGS_DEFAULT, /* tp_flags */ | 55 | Py_TPFLAGS_DEFAULT, /* tp_flags */ |
57 | "", /* tp_doc */ | 56 | "", /* tp_doc */ |
58 | 0, /* tp_traverse */ | 57 | 0, /* tp_traverse */ |
59 | 0, /* tp_clear */ | 58 | 0, /* tp_clear */ |
60 | 0, /* tp_richcompare */ | 59 | 0, /* tp_richcompare */ |
61 | 0, /* tp_weaklistoffset */ | 60 | 0, /* tp_weaklistoffset */ |
62 | 0, /* tp_iter */ | 61 | 0, /* tp_iter */ |
63 | 0, /* tp_iternext */ | 62 | 0, /* tp_iternext */ |
64 | 0, /* tp_methods */ | 63 | 0, /* tp_methods */ |
65 | 0, /* tp_members */ | 64 | 0, /* tp_members */ |
66 | 0, /* tp_getset */ | 65 | 0, /* tp_getset */ |
... | @@ -102,15 +101,18 @@ static PyMethodDef methods[] = { | ... | @@ -102,15 +101,18 @@ static PyMethodDef methods[] = { |
102 | }; | 101 | }; |
103 | 102 | ||
104 | void | 103 | void |
105 | init_debug () | 104 | mu_py_init_debug (void) |
106 | { | 105 | { |
107 | PyObject *m; | ||
108 | |||
109 | PyDebugType.tp_new = PyType_GenericNew; | 106 | PyDebugType.tp_new = PyType_GenericNew; |
110 | if (PyType_Ready (&PyDebugType) < 0) | 107 | if (PyType_Ready (&PyDebugType) < 0) |
111 | return; | 108 | return; |
109 | } | ||
112 | 110 | ||
113 | if ((m = attach_module (PY_MODULE, methods))) | 111 | void |
112 | _mu_py_attach_debug (void) | ||
113 | { | ||
114 | PyObject *m; | ||
115 | if ((m = _mu_py_attach_module (PY_MODULE, methods))) | ||
114 | { | 116 | { |
115 | Py_INCREF (&PyDebugType); | 117 | Py_INCREF (&PyDebugType); |
116 | PyModule_AddObject (m, PY_CSNAME, (PyObject *)&PyDebugType); | 118 | PyModule_AddObject (m, PY_CSNAME, (PyObject *)&PyDebugType); | ... | ... |
... | @@ -18,8 +18,7 @@ | ... | @@ -18,8 +18,7 @@ |
18 | Boston, MA 02110-1301 USA | 18 | Boston, MA 02110-1301 USA |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include "c_api.h" | 21 | #include "libmu_py.h" |
22 | #include "envelope-private.h" | ||
23 | 22 | ||
24 | #define PY_MODULE "envelope" | 23 | #define PY_MODULE "envelope" |
25 | #define PY_CSNAME "EnvelopeType" | 24 | #define PY_CSNAME "EnvelopeType" |
... | @@ -38,7 +37,7 @@ static PyTypeObject PyEnvelopeType = { | ... | @@ -38,7 +37,7 @@ static PyTypeObject PyEnvelopeType = { |
38 | PY_MODULE "." PY_CSNAME, /* tp_name */ | 37 | PY_MODULE "." PY_CSNAME, /* tp_name */ |
39 | sizeof (PyEnvelope), /* tp_basicsize */ | 38 | sizeof (PyEnvelope), /* tp_basicsize */ |
40 | 0, /* tp_itemsize */ | 39 | 0, /* tp_itemsize */ |
41 | (destructor)py_dealloc, /* tp_dealloc */ | 40 | (destructor)_py_dealloc, /* tp_dealloc */ |
42 | 0, /* tp_print */ | 41 | 0, /* tp_print */ |
43 | 0, /* tp_getattr; __getattr__ */ | 42 | 0, /* tp_getattr; __getattr__ */ |
44 | 0, /* tp_setattr; __setattr__ */ | 43 | 0, /* tp_setattr; __setattr__ */ |
... | @@ -55,12 +54,12 @@ static PyTypeObject PyEnvelopeType = { | ... | @@ -55,12 +54,12 @@ static PyTypeObject PyEnvelopeType = { |
55 | 0, /* tp_as_buffer */ | 54 | 0, /* tp_as_buffer */ |
56 | Py_TPFLAGS_DEFAULT, /* tp_flags */ | 55 | Py_TPFLAGS_DEFAULT, /* tp_flags */ |
57 | "", /* tp_doc */ | 56 | "", /* tp_doc */ |
58 | 0, /* tp_traverse */ | 57 | 0, /* tp_traverse */ |
59 | 0, /* tp_clear */ | 58 | 0, /* tp_clear */ |
60 | 0, /* tp_richcompare */ | 59 | 0, /* tp_richcompare */ |
61 | 0, /* tp_weaklistoffset */ | 60 | 0, /* tp_weaklistoffset */ |
62 | 0, /* tp_iter */ | 61 | 0, /* tp_iter */ |
63 | 0, /* tp_iternext */ | 62 | 0, /* tp_iternext */ |
64 | 0, /* tp_methods */ | 63 | 0, /* tp_methods */ |
65 | 0, /* tp_members */ | 64 | 0, /* tp_members */ |
66 | 0, /* tp_getset */ | 65 | 0, /* tp_getset */ |
... | @@ -150,15 +149,18 @@ static PyMethodDef methods[] = { | ... | @@ -150,15 +149,18 @@ static PyMethodDef methods[] = { |
150 | }; | 149 | }; |
151 | 150 | ||
152 | void | 151 | void |
153 | init_envelope () | 152 | mu_py_init_envelope () |
154 | { | 153 | { |
155 | PyObject *m; | ||
156 | |||
157 | PyEnvelopeType.tp_new = PyType_GenericNew; | 154 | PyEnvelopeType.tp_new = PyType_GenericNew; |
158 | if (PyType_Ready (&PyEnvelopeType) < 0) | 155 | if (PyType_Ready (&PyEnvelopeType) < 0) |
159 | return; | 156 | return; |
157 | } | ||
160 | 158 | ||
161 | if ((m = attach_module (PY_MODULE, methods))) | 159 | void |
160 | _mu_py_attach_envelope (void) | ||
161 | { | ||
162 | PyObject *m; | ||
163 | if ((m = _mu_py_attach_module (PY_MODULE, methods))) | ||
162 | { | 164 | { |
163 | Py_INCREF (&PyEnvelopeType); | 165 | Py_INCREF (&PyEnvelopeType); |
164 | PyModule_AddObject (m, PY_CSNAME, (PyObject *)&PyEnvelopeType); | 166 | PyModule_AddObject (m, PY_CSNAME, (PyObject *)&PyEnvelopeType); | ... | ... |
... | @@ -18,7 +18,7 @@ | ... | @@ -18,7 +18,7 @@ |
18 | Boston, MA 02110-1301 USA | 18 | Boston, MA 02110-1301 USA |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include "c_api.h" | 21 | #include "libmu_py.h" |
22 | 22 | ||
23 | #define PY_MODULE "error" | 23 | #define PY_MODULE "error" |
24 | 24 | ||
... | @@ -44,7 +44,7 @@ static PyMethodDef methods[] = { | ... | @@ -44,7 +44,7 @@ static PyMethodDef methods[] = { |
44 | }; | 44 | }; |
45 | 45 | ||
46 | void | 46 | void |
47 | init_error () | 47 | _mu_py_attach_error (void) |
48 | { | 48 | { |
49 | attach_module (PY_MODULE, methods); | 49 | _mu_py_attach_module (PY_MODULE, methods); |
50 | } | 50 | } | ... | ... |
... | @@ -18,9 +18,7 @@ | ... | @@ -18,9 +18,7 @@ |
18 | Boston, MA 02110-1301 USA | 18 | Boston, MA 02110-1301 USA |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include "c_api.h" | 21 | #include "libmu_py.h" |
22 | #include "stream-private.h" | ||
23 | #include <mailutils/filter.h> | ||
24 | 22 | ||
25 | #define PY_MODULE "filter" | 23 | #define PY_MODULE "filter" |
26 | 24 | ||
... | @@ -85,7 +83,7 @@ static PyMethodDef methods[] = { | ... | @@ -85,7 +83,7 @@ static PyMethodDef methods[] = { |
85 | }; | 83 | }; |
86 | 84 | ||
87 | void | 85 | void |
88 | init_filter () | 86 | _mu_py_attach_filter (void) |
89 | { | 87 | { |
90 | attach_module (PY_MODULE, methods); | 88 | _mu_py_attach_module (PY_MODULE, methods); |
91 | } | 89 | } | ... | ... |
... | @@ -18,11 +18,7 @@ | ... | @@ -18,11 +18,7 @@ |
18 | Boston, MA 02110-1301 USA | 18 | Boston, MA 02110-1301 USA |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include "c_api.h" | 21 | #include "libmu_py.h" |
22 | #include "folder-private.h" | ||
23 | #include "stream-private.h" | ||
24 | #include "auth-private.h" | ||
25 | #include "url-private.h" | ||
26 | 22 | ||
27 | #define PY_MODULE "folder" | 23 | #define PY_MODULE "folder" |
28 | #define PY_CSNAME "FolderType" | 24 | #define PY_CSNAME "FolderType" |
... | @@ -41,7 +37,7 @@ static PyTypeObject PyFolderType = { | ... | @@ -41,7 +37,7 @@ static PyTypeObject PyFolderType = { |
41 | PY_MODULE "." PY_CSNAME, /* tp_name */ | 37 | PY_MODULE "." PY_CSNAME, /* tp_name */ |
42 | sizeof (PyFolder), /* tp_basicsize */ | 38 | sizeof (PyFolder), /* tp_basicsize */ |
43 | 0, /* tp_itemsize */ | 39 | 0, /* tp_itemsize */ |
44 | (destructor)py_dealloc, /* tp_dealloc */ | 40 | (destructor)_py_dealloc, /* tp_dealloc */ |
45 | 0, /* tp_print */ | 41 | 0, /* tp_print */ |
46 | 0, /* tp_getattr; __getattr__ */ | 42 | 0, /* tp_getattr; __getattr__ */ |
47 | 0, /* tp_setattr; __setattr__ */ | 43 | 0, /* tp_setattr; __setattr__ */ |
... | @@ -58,12 +54,12 @@ static PyTypeObject PyFolderType = { | ... | @@ -58,12 +54,12 @@ static PyTypeObject PyFolderType = { |
58 | 0, /* tp_as_buffer */ | 54 | 0, /* tp_as_buffer */ |
59 | Py_TPFLAGS_DEFAULT, /* tp_flags */ | 55 | Py_TPFLAGS_DEFAULT, /* tp_flags */ |
60 | "", /* tp_doc */ | 56 | "", /* tp_doc */ |
61 | 0, /* tp_traverse */ | 57 | 0, /* tp_traverse */ |
62 | 0, /* tp_clear */ | 58 | 0, /* tp_clear */ |
63 | 0, /* tp_richcompare */ | 59 | 0, /* tp_richcompare */ |
64 | 0, /* tp_weaklistoffset */ | 60 | 0, /* tp_weaklistoffset */ |
65 | 0, /* tp_iter */ | 61 | 0, /* tp_iter */ |
66 | 0, /* tp_iternext */ | 62 | 0, /* tp_iternext */ |
67 | 0, /* tp_methods */ | 63 | 0, /* tp_methods */ |
68 | 0, /* tp_members */ | 64 | 0, /* tp_members */ |
69 | 0, /* tp_getset */ | 65 | 0, /* tp_getset */ |
... | @@ -260,7 +256,7 @@ api_folder_list (PyObject *self, PyObject *args) | ... | @@ -260,7 +256,7 @@ api_folder_list (PyObject *self, PyObject *args) |
260 | &c_list); | 256 | &c_list); |
261 | 257 | ||
262 | if (c_list) | 258 | if (c_list) |
263 | py_list = mulist_to_pylist (c_list, folderdata_extractor); | 259 | py_list = mu_py_mulist_to_pylist (c_list, folderdata_extractor); |
264 | else | 260 | else |
265 | py_list = PyTuple_New (0); | 261 | py_list = PyTuple_New (0); |
266 | 262 | ||
... | @@ -302,15 +298,18 @@ static PyMethodDef methods[] = { | ... | @@ -302,15 +298,18 @@ static PyMethodDef methods[] = { |
302 | }; | 298 | }; |
303 | 299 | ||
304 | void | 300 | void |
305 | init_folder () | 301 | mu_py_init_folder (void) |
306 | { | 302 | { |
307 | PyObject *m; | ||
308 | |||
309 | PyFolderType.tp_new = PyType_GenericNew; | 303 | PyFolderType.tp_new = PyType_GenericNew; |
310 | if (PyType_Ready (&PyFolderType) < 0) | 304 | if (PyType_Ready (&PyFolderType) < 0) |
311 | return; | 305 | return; |
306 | } | ||
312 | 307 | ||
313 | if ((m = attach_module (PY_MODULE, methods))) | 308 | void |
309 | _mu_py_attach_folder (void) | ||
310 | { | ||
311 | PyObject *m; | ||
312 | if ((m = _mu_py_attach_module (PY_MODULE, methods))) | ||
314 | { | 313 | { |
315 | Py_INCREF (&PyFolderType); | 314 | Py_INCREF (&PyFolderType); |
316 | PyModule_AddObject (m, PY_CSNAME, (PyObject *)&PyFolderType); | 315 | PyModule_AddObject (m, PY_CSNAME, (PyObject *)&PyFolderType); | ... | ... |
... | @@ -18,8 +18,7 @@ | ... | @@ -18,8 +18,7 @@ |
18 | Boston, MA 02110-1301 USA | 18 | Boston, MA 02110-1301 USA |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include "c_api.h" | 21 | #include "libmu_py.h" |
22 | #include "header-private.h" | ||
23 | 22 | ||
24 | #define PY_MODULE "header" | 23 | #define PY_MODULE "header" |
25 | #define PY_CSNAME "HeaderType" | 24 | #define PY_CSNAME "HeaderType" |
... | @@ -38,7 +37,7 @@ static PyTypeObject PyHeaderType = { | ... | @@ -38,7 +37,7 @@ static PyTypeObject PyHeaderType = { |
38 | PY_MODULE "." PY_CSNAME, /* tp_name */ | 37 | PY_MODULE "." PY_CSNAME, /* tp_name */ |
39 | sizeof (PyHeader), /* tp_basicsize */ | 38 | sizeof (PyHeader), /* tp_basicsize */ |
40 | 0, /* tp_itemsize */ | 39 | 0, /* tp_itemsize */ |
41 | (destructor)py_dealloc, /* tp_dealloc */ | 40 | (destructor)_py_dealloc, /* tp_dealloc */ |
42 | 0, /* tp_print */ | 41 | 0, /* tp_print */ |
43 | 0, /* tp_getattr; __getattr__ */ | 42 | 0, /* tp_getattr; __getattr__ */ |
44 | 0, /* tp_setattr; __setattr__ */ | 43 | 0, /* tp_setattr; __setattr__ */ |
... | @@ -55,12 +54,12 @@ static PyTypeObject PyHeaderType = { | ... | @@ -55,12 +54,12 @@ static PyTypeObject PyHeaderType = { |
55 | 0, /* tp_as_buffer */ | 54 | 0, /* tp_as_buffer */ |
56 | Py_TPFLAGS_DEFAULT, /* tp_flags */ | 55 | Py_TPFLAGS_DEFAULT, /* tp_flags */ |
57 | "", /* tp_doc */ | 56 | "", /* tp_doc */ |
58 | 0, /* tp_traverse */ | 57 | 0, /* tp_traverse */ |
59 | 0, /* tp_clear */ | 58 | 0, /* tp_clear */ |
60 | 0, /* tp_richcompare */ | 59 | 0, /* tp_richcompare */ |
61 | 0, /* tp_weaklistoffset */ | 60 | 0, /* tp_weaklistoffset */ |
62 | 0, /* tp_iter */ | 61 | 0, /* tp_iter */ |
63 | 0, /* tp_iternext */ | 62 | 0, /* tp_iternext */ |
64 | 0, /* tp_methods */ | 63 | 0, /* tp_methods */ |
65 | 0, /* tp_members */ | 64 | 0, /* tp_members */ |
66 | 0, /* tp_getset */ | 65 | 0, /* tp_getset */ |
... | @@ -208,15 +207,18 @@ static PyMethodDef methods[] = { | ... | @@ -208,15 +207,18 @@ static PyMethodDef methods[] = { |
208 | }; | 207 | }; |
209 | 208 | ||
210 | void | 209 | void |
211 | init_header () | 210 | mu_py_init_header (void) |
212 | { | 211 | { |
213 | PyObject *m; | ||
214 | |||
215 | PyHeaderType.tp_new = PyType_GenericNew; | 212 | PyHeaderType.tp_new = PyType_GenericNew; |
216 | if (PyType_Ready (&PyHeaderType) < 0) | 213 | if (PyType_Ready (&PyHeaderType) < 0) |
217 | return; | 214 | return; |
215 | } | ||
218 | 216 | ||
219 | if ((m = attach_module (PY_MODULE, methods))) | 217 | void |
218 | _mu_py_attach_header (void) | ||
219 | { | ||
220 | PyObject *m; | ||
221 | if ((m = _mu_py_attach_module (PY_MODULE, methods))) | ||
220 | { | 222 | { |
221 | Py_INCREF (&PyHeaderType); | 223 | Py_INCREF (&PyHeaderType); |
222 | PyModule_AddObject (m, PY_CSNAME, (PyObject *)&PyHeaderType); | 224 | PyModule_AddObject (m, PY_CSNAME, (PyObject *)&PyHeaderType); | ... | ... |
... | @@ -18,7 +18,7 @@ | ... | @@ -18,7 +18,7 @@ |
18 | Boston, MA 02110-1301 USA | 18 | Boston, MA 02110-1301 USA |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include "c_api.h" | 21 | #include "libmu_py.h" |
22 | 22 | ||
23 | inline PyObject * | 23 | inline PyObject * |
24 | _ro (PyObject *obj) | 24 | _ro (PyObject *obj) |
... | @@ -28,7 +28,7 @@ _ro (PyObject *obj) | ... | @@ -28,7 +28,7 @@ _ro (PyObject *obj) |
28 | } | 28 | } |
29 | 29 | ||
30 | void | 30 | void |
31 | py_dealloc (PyObject *self) | 31 | _py_dealloc (PyObject *self) |
32 | { | 32 | { |
33 | self->ob_type->tp_free (self); | 33 | self->ob_type->tp_free (self); |
34 | } | 34 | } |
... | @@ -42,15 +42,11 @@ status_object (int status, PyObject *py_obj) | ... | @@ -42,15 +42,11 @@ status_object (int status, PyObject *py_obj) |
42 | return _ro (py_ret); | 42 | return _ro (py_ret); |
43 | } | 43 | } |
44 | 44 | ||
45 | static PyMethodDef nomethods[] = { | ||
46 | { NULL, NULL } | ||
47 | }; | ||
48 | |||
49 | static PyObject *package; | 45 | static PyObject *package; |
50 | static PyObject *all; | 46 | static PyObject *all; |
51 | 47 | ||
52 | PyObject * | 48 | PyObject * |
53 | attach_module (const char *name, PyMethodDef *methods) | 49 | _mu_py_attach_module (const char *name, PyMethodDef *methods) |
54 | { | 50 | { |
55 | PyObject *module, *m; | 51 | PyObject *module, *m; |
56 | 52 | ||
... | @@ -72,8 +68,32 @@ attach_module (const char *name, PyMethodDef *methods) | ... | @@ -72,8 +68,32 @@ attach_module (const char *name, PyMethodDef *methods) |
72 | return m; | 68 | return m; |
73 | } | 69 | } |
74 | 70 | ||
75 | PyMODINIT_FUNC | 71 | void |
76 | initc_api (void) | 72 | mu_py_init (void) |
73 | { | ||
74 | mu_py_init_address (); | ||
75 | mu_py_init_attribute (); | ||
76 | mu_py_init_auth (); | ||
77 | mu_py_init_body (); | ||
78 | mu_py_init_debug (); | ||
79 | mu_py_init_envelope (); | ||
80 | mu_py_init_header (); | ||
81 | mu_py_init_folder (); | ||
82 | mu_py_init_mailer (); | ||
83 | mu_py_init_mailbox (); | ||
84 | mu_py_init_mailcap (); | ||
85 | mu_py_init_message (); | ||
86 | mu_py_init_mime (); | ||
87 | mu_py_init_stream (); | ||
88 | mu_py_init_url (); | ||
89 | } | ||
90 | |||
91 | static PyMethodDef nomethods[] = { | ||
92 | { NULL, NULL } | ||
93 | }; | ||
94 | |||
95 | void | ||
96 | mu_py_attach_modules (void) | ||
77 | { | 97 | { |
78 | package = Py_InitModule (PY_ROOT_NAME, nomethods); | 98 | package = Py_InitModule (PY_ROOT_NAME, nomethods); |
79 | if (!package) | 99 | if (!package) |
... | @@ -87,23 +107,23 @@ initc_api (void) | ... | @@ -87,23 +107,23 @@ initc_api (void) |
87 | return; | 107 | return; |
88 | } | 108 | } |
89 | 109 | ||
90 | init_error (); | 110 | _mu_py_attach_error (); |
91 | init_address (); | 111 | _mu_py_attach_address (); |
92 | init_attribute (); | 112 | _mu_py_attach_attribute (); |
93 | init_auth (); | 113 | _mu_py_attach_auth (); |
94 | init_body (); | 114 | _mu_py_attach_body (); |
95 | init_debug (); | 115 | _mu_py_attach_debug (); |
96 | init_envelope (); | 116 | _mu_py_attach_envelope (); |
97 | init_header (); | 117 | _mu_py_attach_header (); |
98 | init_filter (); | 118 | _mu_py_attach_filter (); |
99 | init_folder (); | 119 | _mu_py_attach_folder (); |
100 | init_mailer (); | 120 | _mu_py_attach_mailer (); |
101 | init_mailbox (); | 121 | _mu_py_attach_mailbox (); |
102 | init_mailcap (); | 122 | _mu_py_attach_mailcap (); |
103 | init_message (); | 123 | _mu_py_attach_message (); |
104 | init_mime (); | 124 | _mu_py_attach_mime (); |
105 | init_registrar (); | 125 | _mu_py_attach_registrar (); |
106 | init_stream (); | 126 | _mu_py_attach_stream (); |
107 | init_url (); | 127 | _mu_py_attach_url (); |
108 | init_util (); | 128 | _mu_py_attach_util (); |
109 | } | 129 | } | ... | ... |
python/libmu_py/libmu_py.h
0 → 100644
1 | /* | ||
2 | GNU Mailutils -- a suite of utilities for electronic mail | ||
3 | Copyright (C) 2009 Free Software Foundation, Inc. | ||
4 | |||
5 | This library is free software; you can redistribute it and/or | ||
6 | modify it under the terms of the GNU Lesser General Public | ||
7 | License as published by the Free Software Foundation; either | ||
8 | version 3 of the License, or (at your option) any later version. | ||
9 | |||
10 | This library is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Lesser General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Lesser General | ||
16 | Public License along with this library; if not, write to the | ||
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301 USA | ||
19 | */ | ||
20 | |||
21 | #ifdef HAVE_CONFIG_H | ||
22 | # include <config.h> | ||
23 | #endif | ||
24 | |||
25 | #include <mailutils/address.h> | ||
26 | #include <mailutils/attribute.h> | ||
27 | #include <mailutils/auth.h> | ||
28 | #include <mailutils/body.h> | ||
29 | #include <mailutils/debug.h> | ||
30 | #include <mailutils/envelope.h> | ||
31 | #include <mailutils/error.h> | ||
32 | #include <mailutils/filter.h> | ||
33 | #include <mailutils/folder.h> | ||
34 | #include <mailutils/header.h> | ||
35 | #include <mailutils/list.h> | ||
36 | #include <mailutils/mailbox.h> | ||
37 | #include <mailutils/mailcap.h> | ||
38 | #include <mailutils/mailer.h> | ||
39 | #include <mailutils/message.h> | ||
40 | #include <mailutils/mime.h> | ||
41 | #include <mailutils/mu_auth.h> | ||
42 | #include <mailutils/mutil.h> | ||
43 | #include <mailutils/registrar.h> | ||
44 | #include <mailutils/tls.h> | ||
45 | #include <mailutils/stream.h> | ||
46 | #include <mailutils/url.h> | ||
47 | #include <mailutils/python.h> | ||
48 | |||
49 | #define PY_PACKAGE_NAME "mailutils" | ||
50 | #define PY_ROOT_NAME "c_api" | ||
51 | #define PY_PACKAGE_VERSION PACKAGE_VERSION | ||
52 | |||
53 | extern inline PyObject * _ro (PyObject *obj); | ||
54 | extern void _py_dealloc (PyObject *self); | ||
55 | extern PyObject * status_object (int status, PyObject *py_obj); | ||
56 | extern PyObject * _mu_py_attach_module (const char *name, PyMethodDef *methods); | ||
57 | |||
58 | extern void mu_py_attach_modules (void); | ||
59 | |||
60 | extern void _mu_py_attach_error (void); | ||
61 | extern void _mu_py_attach_address (void); | ||
62 | extern void _mu_py_attach_attribute (void); | ||
63 | extern void _mu_py_attach_auth (void); | ||
64 | extern void _mu_py_attach_body (void); | ||
65 | extern void _mu_py_attach_debug (void); | ||
66 | extern void _mu_py_attach_envelope (void); | ||
67 | extern void _mu_py_attach_header (void); | ||
68 | extern void _mu_py_attach_filter (void); | ||
69 | extern void _mu_py_attach_folder (void); | ||
70 | extern void _mu_py_attach_mailer (void); | ||
71 | extern void _mu_py_attach_mailbox (void); | ||
72 | extern void _mu_py_attach_mailcap (void); | ||
73 | extern void _mu_py_attach_message (void); | ||
74 | extern void _mu_py_attach_mime (void); | ||
75 | extern void _mu_py_attach_registrar (void); | ||
76 | extern void _mu_py_attach_stream (void); | ||
77 | extern void _mu_py_attach_url (void); | ||
78 | extern void _mu_py_attach_util (void); |
... | @@ -18,11 +18,10 @@ | ... | @@ -18,11 +18,10 @@ |
18 | Boston, MA 02110-1301 USA | 18 | Boston, MA 02110-1301 USA |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include "c_api.h" | 21 | #include "libmu_py.h" |
22 | #include "list-private.h" | ||
23 | 22 | ||
24 | PyObject * | 23 | PyObject * |
25 | mulist_to_pylist (mu_list_t list, mulist_extractor_fp extractor) | 24 | mu_py_mulist_to_pylist (mu_list_t list, mulist_extractor_fp extractor) |
26 | { | 25 | { |
27 | int status, i; | 26 | int status, i; |
28 | size_t list_count; | 27 | size_t list_count; | ... | ... |
... | @@ -18,12 +18,7 @@ | ... | @@ -18,12 +18,7 @@ |
18 | Boston, MA 02110-1301 USA | 18 | Boston, MA 02110-1301 USA |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include "c_api.h" | 21 | #include "libmu_py.h" |
22 | #include "mailbox-private.h" | ||
23 | #include "message-private.h" | ||
24 | #include "folder-private.h" | ||
25 | #include "url-private.h" | ||
26 | #include "debug-private.h" | ||
27 | 22 | ||
28 | #define PY_MODULE "mailbox" | 23 | #define PY_MODULE "mailbox" |
29 | #define PY_CSNAME "MailboxType" | 24 | #define PY_CSNAME "MailboxType" |
... | @@ -42,7 +37,7 @@ static PyTypeObject PyMailboxType = { | ... | @@ -42,7 +37,7 @@ static PyTypeObject PyMailboxType = { |
42 | PY_MODULE "." PY_CSNAME, /* tp_name */ | 37 | PY_MODULE "." PY_CSNAME, /* tp_name */ |
43 | sizeof (PyMailbox), /* tp_basicsize */ | 38 | sizeof (PyMailbox), /* tp_basicsize */ |
44 | 0, /* tp_itemsize */ | 39 | 0, /* tp_itemsize */ |
45 | (destructor)py_dealloc, /* tp_dealloc */ | 40 | (destructor)_py_dealloc, /* tp_dealloc */ |
46 | 0, /* tp_print */ | 41 | 0, /* tp_print */ |
47 | 0, /* tp_getattr; __getattr__ */ | 42 | 0, /* tp_getattr; __getattr__ */ |
48 | 0, /* tp_setattr; __setattr__ */ | 43 | 0, /* tp_setattr; __setattr__ */ |
... | @@ -59,12 +54,12 @@ static PyTypeObject PyMailboxType = { | ... | @@ -59,12 +54,12 @@ static PyTypeObject PyMailboxType = { |
59 | 0, /* tp_as_buffer */ | 54 | 0, /* tp_as_buffer */ |
60 | Py_TPFLAGS_DEFAULT, /* tp_flags */ | 55 | Py_TPFLAGS_DEFAULT, /* tp_flags */ |
61 | "", /* tp_doc */ | 56 | "", /* tp_doc */ |
62 | 0, /* tp_traverse */ | 57 | 0, /* tp_traverse */ |
63 | 0, /* tp_clear */ | 58 | 0, /* tp_clear */ |
64 | 0, /* tp_richcompare */ | 59 | 0, /* tp_richcompare */ |
65 | 0, /* tp_weaklistoffset */ | 60 | 0, /* tp_weaklistoffset */ |
66 | 0, /* tp_iter */ | 61 | 0, /* tp_iter */ |
67 | 0, /* tp_iternext */ | 62 | 0, /* tp_iternext */ |
68 | 0, /* tp_methods */ | 63 | 0, /* tp_methods */ |
69 | 0, /* tp_members */ | 64 | 0, /* tp_members */ |
70 | 0, /* tp_getset */ | 65 | 0, /* tp_getset */ |
... | @@ -418,15 +413,18 @@ static PyMethodDef methods[] = { | ... | @@ -418,15 +413,18 @@ static PyMethodDef methods[] = { |
418 | }; | 413 | }; |
419 | 414 | ||
420 | void | 415 | void |
421 | init_mailbox () | 416 | mu_py_init_mailbox (void) |
422 | { | 417 | { |
423 | PyObject *m; | ||
424 | |||
425 | PyMailboxType.tp_new = PyType_GenericNew; | 418 | PyMailboxType.tp_new = PyType_GenericNew; |
426 | if (PyType_Ready (&PyMailboxType) < 0) | 419 | if (PyType_Ready (&PyMailboxType) < 0) |
427 | return; | 420 | return; |
421 | } | ||
428 | 422 | ||
429 | if ((m = attach_module (PY_MODULE, methods))) | 423 | void |
424 | _mu_py_attach_mailbox (void) | ||
425 | { | ||
426 | PyObject *m; | ||
427 | if ((m = _mu_py_attach_module (PY_MODULE, methods))) | ||
430 | { | 428 | { |
431 | Py_INCREF (&PyMailboxType); | 429 | Py_INCREF (&PyMailboxType); |
432 | PyModule_AddObject (m, PY_CSNAME, (PyObject *)&PyMailboxType); | 430 | PyModule_AddObject (m, PY_CSNAME, (PyObject *)&PyMailboxType); | ... | ... |
... | @@ -18,9 +18,7 @@ | ... | @@ -18,9 +18,7 @@ |
18 | Boston, MA 02110-1301 USA | 18 | Boston, MA 02110-1301 USA |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include "c_api.h" | 21 | #include "libmu_py.h" |
22 | #include "mailcap-private.h" | ||
23 | #include "stream-private.h" | ||
24 | 22 | ||
25 | #define PY_MODULE "mailcap" | 23 | #define PY_MODULE "mailcap" |
26 | #define PY_CSNAME1 "MailcapType" | 24 | #define PY_CSNAME1 "MailcapType" |
... | @@ -40,7 +38,7 @@ static PyTypeObject PyMailcapType = { | ... | @@ -40,7 +38,7 @@ static PyTypeObject PyMailcapType = { |
40 | PY_MODULE "." PY_CSNAME1, /* tp_name */ | 38 | PY_MODULE "." PY_CSNAME1, /* tp_name */ |
41 | sizeof (PyMailcap), /* tp_basicsize */ | 39 | sizeof (PyMailcap), /* tp_basicsize */ |
42 | 0, /* tp_itemsize */ | 40 | 0, /* tp_itemsize */ |
43 | (destructor)py_dealloc, /* tp_dealloc */ | 41 | (destructor)_py_dealloc, /* tp_dealloc */ |
44 | 0, /* tp_print */ | 42 | 0, /* tp_print */ |
45 | 0, /* tp_getattr; __getattr__ */ | 43 | 0, /* tp_getattr; __getattr__ */ |
46 | 0, /* tp_setattr; __setattr__ */ | 44 | 0, /* tp_setattr; __setattr__ */ |
... | @@ -57,12 +55,12 @@ static PyTypeObject PyMailcapType = { | ... | @@ -57,12 +55,12 @@ static PyTypeObject PyMailcapType = { |
57 | 0, /* tp_as_buffer */ | 55 | 0, /* tp_as_buffer */ |
58 | Py_TPFLAGS_DEFAULT, /* tp_flags */ | 56 | Py_TPFLAGS_DEFAULT, /* tp_flags */ |
59 | "", /* tp_doc */ | 57 | "", /* tp_doc */ |
60 | 0, /* tp_traverse */ | 58 | 0, /* tp_traverse */ |
61 | 0, /* tp_clear */ | 59 | 0, /* tp_clear */ |
62 | 0, /* tp_richcompare */ | 60 | 0, /* tp_richcompare */ |
63 | 0, /* tp_weaklistoffset */ | 61 | 0, /* tp_weaklistoffset */ |
64 | 0, /* tp_iter */ | 62 | 0, /* tp_iter */ |
65 | 0, /* tp_iternext */ | 63 | 0, /* tp_iternext */ |
66 | 0, /* tp_methods */ | 64 | 0, /* tp_methods */ |
67 | 0, /* tp_members */ | 65 | 0, /* tp_members */ |
68 | 0, /* tp_getset */ | 66 | 0, /* tp_getset */ |
... | @@ -96,7 +94,7 @@ static PyTypeObject PyMailcapEntryType = { | ... | @@ -96,7 +94,7 @@ static PyTypeObject PyMailcapEntryType = { |
96 | PY_MODULE "." PY_CSNAME2, /* tp_name */ | 94 | PY_MODULE "." PY_CSNAME2, /* tp_name */ |
97 | sizeof (PyMailcapEntry), /* tp_basicsize */ | 95 | sizeof (PyMailcapEntry), /* tp_basicsize */ |
98 | 0, /* tp_itemsize */ | 96 | 0, /* tp_itemsize */ |
99 | (destructor)py_dealloc, /* tp_dealloc */ | 97 | (destructor)_py_dealloc, /* tp_dealloc */ |
100 | 0, /* tp_print */ | 98 | 0, /* tp_print */ |
101 | 0, /* tp_getattr; __getattr__ */ | 99 | 0, /* tp_getattr; __getattr__ */ |
102 | 0, /* tp_setattr; __setattr__ */ | 100 | 0, /* tp_setattr; __setattr__ */ |
... | @@ -113,12 +111,12 @@ static PyTypeObject PyMailcapEntryType = { | ... | @@ -113,12 +111,12 @@ static PyTypeObject PyMailcapEntryType = { |
113 | 0, /* tp_as_buffer */ | 111 | 0, /* tp_as_buffer */ |
114 | Py_TPFLAGS_DEFAULT, /* tp_flags */ | 112 | Py_TPFLAGS_DEFAULT, /* tp_flags */ |
115 | "", /* tp_doc */ | 113 | "", /* tp_doc */ |
116 | 0, /* tp_traverse */ | 114 | 0, /* tp_traverse */ |
117 | 0, /* tp_clear */ | 115 | 0, /* tp_clear */ |
118 | 0, /* tp_richcompare */ | 116 | 0, /* tp_richcompare */ |
119 | 0, /* tp_weaklistoffset */ | 117 | 0, /* tp_weaklistoffset */ |
120 | 0, /* tp_iter */ | 118 | 0, /* tp_iter */ |
121 | 0, /* tp_iternext */ | 119 | 0, /* tp_iternext */ |
122 | 0, /* tp_methods */ | 120 | 0, /* tp_methods */ |
123 | 0, /* tp_members */ | 121 | 0, /* tp_members */ |
124 | 0, /* tp_getset */ | 122 | 0, /* tp_getset */ |
... | @@ -295,17 +293,20 @@ static PyMethodDef methods[] = { | ... | @@ -295,17 +293,20 @@ static PyMethodDef methods[] = { |
295 | }; | 293 | }; |
296 | 294 | ||
297 | void | 295 | void |
298 | init_mailcap () | 296 | mu_py_init_mailcap (void) |
299 | { | 297 | { |
300 | PyObject *m; | ||
301 | |||
302 | PyMailcapType.tp_new = PyType_GenericNew; | 298 | PyMailcapType.tp_new = PyType_GenericNew; |
303 | PyMailcapEntryType.tp_new = PyType_GenericNew; | 299 | PyMailcapEntryType.tp_new = PyType_GenericNew; |
304 | if (PyType_Ready (&PyMailcapType) < 0 || | 300 | if (PyType_Ready (&PyMailcapType) < 0 || |
305 | PyType_Ready (&PyMailcapEntryType) < 0) | 301 | PyType_Ready (&PyMailcapEntryType) < 0) |
306 | return; | 302 | return; |
303 | } | ||
307 | 304 | ||
308 | if ((m = attach_module (PY_MODULE, methods))) | 305 | void |
306 | _mu_py_attach_mailcap (void) | ||
307 | { | ||
308 | PyObject *m; | ||
309 | if ((m = _mu_py_attach_module (PY_MODULE, methods))) | ||
309 | { | 310 | { |
310 | Py_INCREF (&PyMailcapType); | 311 | Py_INCREF (&PyMailcapType); |
311 | Py_INCREF (&PyMailcapEntryType); | 312 | Py_INCREF (&PyMailcapEntryType); | ... | ... |
... | @@ -18,11 +18,7 @@ | ... | @@ -18,11 +18,7 @@ |
18 | Boston, MA 02110-1301 USA | 18 | Boston, MA 02110-1301 USA |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include "c_api.h" | 21 | #include "libmu_py.h" |
22 | #include "mailer-private.h" | ||
23 | #include "address-private.h" | ||
24 | #include "message-private.h" | ||
25 | #include "debug-private.h" | ||
26 | 22 | ||
27 | #define PY_MODULE "mailer" | 23 | #define PY_MODULE "mailer" |
28 | #define PY_CSNAME "MailerType" | 24 | #define PY_CSNAME "MailerType" |
... | @@ -41,7 +37,7 @@ static PyTypeObject PyMailerType = { | ... | @@ -41,7 +37,7 @@ static PyTypeObject PyMailerType = { |
41 | PY_MODULE "." PY_CSNAME, /* tp_name */ | 37 | PY_MODULE "." PY_CSNAME, /* tp_name */ |
42 | sizeof (PyMailer), /* tp_basicsize */ | 38 | sizeof (PyMailer), /* tp_basicsize */ |
43 | 0, /* tp_itemsize */ | 39 | 0, /* tp_itemsize */ |
44 | (destructor)py_dealloc, /* tp_dealloc */ | 40 | (destructor)_py_dealloc, /* tp_dealloc */ |
45 | 0, /* tp_print */ | 41 | 0, /* tp_print */ |
46 | 0, /* tp_getattr; __getattr__ */ | 42 | 0, /* tp_getattr; __getattr__ */ |
47 | 0, /* tp_setattr; __setattr__ */ | 43 | 0, /* tp_setattr; __setattr__ */ |
... | @@ -58,12 +54,12 @@ static PyTypeObject PyMailerType = { | ... | @@ -58,12 +54,12 @@ static PyTypeObject PyMailerType = { |
58 | 0, /* tp_as_buffer */ | 54 | 0, /* tp_as_buffer */ |
59 | Py_TPFLAGS_DEFAULT, /* tp_flags */ | 55 | Py_TPFLAGS_DEFAULT, /* tp_flags */ |
60 | "", /* tp_doc */ | 56 | "", /* tp_doc */ |
61 | 0, /* tp_traverse */ | 57 | 0, /* tp_traverse */ |
62 | 0, /* tp_clear */ | 58 | 0, /* tp_clear */ |
63 | 0, /* tp_richcompare */ | 59 | 0, /* tp_richcompare */ |
64 | 0, /* tp_weaklistoffset */ | 60 | 0, /* tp_weaklistoffset */ |
65 | 0, /* tp_iter */ | 61 | 0, /* tp_iter */ |
66 | 0, /* tp_iternext */ | 62 | 0, /* tp_iternext */ |
67 | 0, /* tp_methods */ | 63 | 0, /* tp_methods */ |
68 | 0, /* tp_members */ | 64 | 0, /* tp_members */ |
69 | 0, /* tp_getset */ | 65 | 0, /* tp_getset */ |
... | @@ -214,15 +210,18 @@ static PyMethodDef methods[] = { | ... | @@ -214,15 +210,18 @@ static PyMethodDef methods[] = { |
214 | }; | 210 | }; |
215 | 211 | ||
216 | void | 212 | void |
217 | init_mailer () | 213 | mu_py_init_mailer (void) |
218 | { | 214 | { |
219 | PyObject *m; | ||
220 | |||
221 | PyMailerType.tp_new = PyType_GenericNew; | 215 | PyMailerType.tp_new = PyType_GenericNew; |
222 | if (PyType_Ready (&PyMailerType) < 0) | 216 | if (PyType_Ready (&PyMailerType) < 0) |
223 | return; | 217 | return; |
218 | } | ||
224 | 219 | ||
225 | if ((m = attach_module (PY_MODULE, methods))) | 220 | void |
221 | _mu_py_attach_mailer (void) | ||
222 | { | ||
223 | PyObject *m; | ||
224 | if ((m = _mu_py_attach_module (PY_MODULE, methods))) | ||
226 | { | 225 | { |
227 | Py_INCREF (&PyMailerType); | 226 | Py_INCREF (&PyMailerType); |
228 | PyModule_AddObject (m, PY_CSNAME, (PyObject *)&PyMailerType); | 227 | PyModule_AddObject (m, PY_CSNAME, (PyObject *)&PyMailerType); | ... | ... |
... | @@ -18,13 +18,7 @@ | ... | @@ -18,13 +18,7 @@ |
18 | Boston, MA 02110-1301 USA | 18 | Boston, MA 02110-1301 USA |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include "c_api.h" | 21 | #include "libmu_py.h" |
22 | #include "message-private.h" | ||
23 | #include "envelope-private.h" | ||
24 | #include "header-private.h" | ||
25 | #include "body-private.h" | ||
26 | #include "attribute-private.h" | ||
27 | #include "stream-private.h" | ||
28 | 22 | ||
29 | #define PY_MODULE "message" | 23 | #define PY_MODULE "message" |
30 | #define PY_CSNAME "MessageType" | 24 | #define PY_CSNAME "MessageType" |
... | @@ -43,7 +37,7 @@ static PyTypeObject PyMessageType = { | ... | @@ -43,7 +37,7 @@ static PyTypeObject PyMessageType = { |
43 | PY_MODULE "." PY_CSNAME, /* tp_name */ | 37 | PY_MODULE "." PY_CSNAME, /* tp_name */ |
44 | sizeof (PyMessage), /* tp_basicsize */ | 38 | sizeof (PyMessage), /* tp_basicsize */ |
45 | 0, /* tp_itemsize */ | 39 | 0, /* tp_itemsize */ |
46 | (destructor)py_dealloc, /* tp_dealloc */ | 40 | (destructor)_py_dealloc, /* tp_dealloc */ |
47 | 0, /* tp_print */ | 41 | 0, /* tp_print */ |
48 | 0, /* tp_getattr; __getattr__ */ | 42 | 0, /* tp_getattr; __getattr__ */ |
49 | 0, /* tp_setattr; __setattr__ */ | 43 | 0, /* tp_setattr; __setattr__ */ |
... | @@ -60,12 +54,12 @@ static PyTypeObject PyMessageType = { | ... | @@ -60,12 +54,12 @@ static PyTypeObject PyMessageType = { |
60 | 0, /* tp_as_buffer */ | 54 | 0, /* tp_as_buffer */ |
61 | Py_TPFLAGS_DEFAULT, /* tp_flags */ | 55 | Py_TPFLAGS_DEFAULT, /* tp_flags */ |
62 | "", /* tp_doc */ | 56 | "", /* tp_doc */ |
63 | 0, /* tp_traverse */ | 57 | 0, /* tp_traverse */ |
64 | 0, /* tp_clear */ | 58 | 0, /* tp_clear */ |
65 | 0, /* tp_richcompare */ | 59 | 0, /* tp_richcompare */ |
66 | 0, /* tp_weaklistoffset */ | 60 | 0, /* tp_weaklistoffset */ |
67 | 0, /* tp_iter */ | 61 | 0, /* tp_iter */ |
68 | 0, /* tp_iternext */ | 62 | 0, /* tp_iternext */ |
69 | 0, /* tp_methods */ | 63 | 0, /* tp_methods */ |
70 | 0, /* tp_members */ | 64 | 0, /* tp_members */ |
71 | 0, /* tp_getset */ | 65 | 0, /* tp_getset */ |
... | @@ -411,15 +405,18 @@ static PyMethodDef methods[] = { | ... | @@ -411,15 +405,18 @@ static PyMethodDef methods[] = { |
411 | }; | 405 | }; |
412 | 406 | ||
413 | void | 407 | void |
414 | init_message () | 408 | mu_py_init_message (void) |
415 | { | 409 | { |
416 | PyObject *m; | ||
417 | |||
418 | PyMessageType.tp_new = PyType_GenericNew; | 410 | PyMessageType.tp_new = PyType_GenericNew; |
419 | if (PyType_Ready (&PyMessageType) < 0) | 411 | if (PyType_Ready (&PyMessageType) < 0) |
420 | return; | 412 | return; |
413 | } | ||
421 | 414 | ||
422 | if ((m = attach_module (PY_MODULE, methods))) | 415 | void |
416 | _mu_py_attach_message (void) | ||
417 | { | ||
418 | PyObject *m; | ||
419 | if ((m = _mu_py_attach_module (PY_MODULE, methods))) | ||
423 | { | 420 | { |
424 | Py_INCREF (&PyMessageType); | 421 | Py_INCREF (&PyMessageType); |
425 | PyModule_AddObject (m, PY_CSNAME, (PyObject *)&PyMessageType); | 422 | PyModule_AddObject (m, PY_CSNAME, (PyObject *)&PyMessageType); | ... | ... |
... | @@ -18,9 +18,7 @@ | ... | @@ -18,9 +18,7 @@ |
18 | Boston, MA 02110-1301 USA | 18 | Boston, MA 02110-1301 USA |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include "c_api.h" | 21 | #include "libmu_py.h" |
22 | #include "mime-private.h" | ||
23 | #include "message-private.h" | ||
24 | 22 | ||
25 | #define PY_MODULE "mime" | 23 | #define PY_MODULE "mime" |
26 | #define PY_CSNAME "MimeType" | 24 | #define PY_CSNAME "MimeType" |
... | @@ -39,7 +37,7 @@ static PyTypeObject PyMimeType = { | ... | @@ -39,7 +37,7 @@ static PyTypeObject PyMimeType = { |
39 | PY_MODULE "." PY_CSNAME, /* tp_name */ | 37 | PY_MODULE "." PY_CSNAME, /* tp_name */ |
40 | sizeof (PyMime), /* tp_basicsize */ | 38 | sizeof (PyMime), /* tp_basicsize */ |
41 | 0, /* tp_itemsize */ | 39 | 0, /* tp_itemsize */ |
42 | (destructor)py_dealloc, /* tp_dealloc */ | 40 | (destructor)_py_dealloc, /* tp_dealloc */ |
43 | 0, /* tp_print */ | 41 | 0, /* tp_print */ |
44 | 0, /* tp_getattr; __getattr__ */ | 42 | 0, /* tp_getattr; __getattr__ */ |
45 | 0, /* tp_setattr; __setattr__ */ | 43 | 0, /* tp_setattr; __setattr__ */ |
... | @@ -56,12 +54,12 @@ static PyTypeObject PyMimeType = { | ... | @@ -56,12 +54,12 @@ static PyTypeObject PyMimeType = { |
56 | 0, /* tp_as_buffer */ | 54 | 0, /* tp_as_buffer */ |
57 | Py_TPFLAGS_DEFAULT, /* tp_flags */ | 55 | Py_TPFLAGS_DEFAULT, /* tp_flags */ |
58 | "", /* tp_doc */ | 56 | "", /* tp_doc */ |
59 | 0, /* tp_traverse */ | 57 | 0, /* tp_traverse */ |
60 | 0, /* tp_clear */ | 58 | 0, /* tp_clear */ |
61 | 0, /* tp_richcompare */ | 59 | 0, /* tp_richcompare */ |
62 | 0, /* tp_weaklistoffset */ | 60 | 0, /* tp_weaklistoffset */ |
63 | 0, /* tp_iter */ | 61 | 0, /* tp_iter */ |
64 | 0, /* tp_iternext */ | 62 | 0, /* tp_iternext */ |
65 | 0, /* tp_methods */ | 63 | 0, /* tp_methods */ |
66 | 0, /* tp_members */ | 64 | 0, /* tp_members */ |
67 | 0, /* tp_getset */ | 65 | 0, /* tp_getset */ |
... | @@ -254,15 +252,18 @@ static PyMethodDef methods[] = { | ... | @@ -254,15 +252,18 @@ static PyMethodDef methods[] = { |
254 | }; | 252 | }; |
255 | 253 | ||
256 | void | 254 | void |
257 | init_mime () | 255 | mu_py_init_mime (void) |
258 | { | 256 | { |
259 | PyObject *m; | ||
260 | |||
261 | PyMimeType.tp_new = PyType_GenericNew; | 257 | PyMimeType.tp_new = PyType_GenericNew; |
262 | if (PyType_Ready (&PyMimeType) < 0) | 258 | if (PyType_Ready (&PyMimeType) < 0) |
263 | return; | 259 | return; |
260 | } | ||
264 | 261 | ||
265 | if ((m = attach_module (PY_MODULE, methods))) | 262 | void |
263 | _mu_py_attach_mime (void) | ||
264 | { | ||
265 | PyObject *m; | ||
266 | if ((m = _mu_py_attach_module (PY_MODULE, methods))) | ||
266 | { | 267 | { |
267 | Py_INCREF (&PyMimeType); | 268 | Py_INCREF (&PyMimeType); |
268 | PyModule_AddObject (m, PY_CSNAME, (PyObject *)&PyMimeType); | 269 | PyModule_AddObject (m, PY_CSNAME, (PyObject *)&PyMimeType); | ... | ... |
... | @@ -18,9 +18,7 @@ | ... | @@ -18,9 +18,7 @@ |
18 | Boston, MA 02110-1301 USA | 18 | Boston, MA 02110-1301 USA |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include "c_api.h" | 21 | #include "libmu_py.h" |
22 | #include <mailutils/registrar.h> | ||
23 | #include <mailutils/tls.h> | ||
24 | 22 | ||
25 | #define PY_MODULE "registrar" | 23 | #define PY_MODULE "registrar" |
26 | 24 | ||
... | @@ -130,9 +128,9 @@ static PyMethodDef methods[] = { | ... | @@ -130,9 +128,9 @@ static PyMethodDef methods[] = { |
130 | }; | 128 | }; |
131 | 129 | ||
132 | void | 130 | void |
133 | init_registrar () | 131 | _mu_py_attach_registrar () |
134 | { | 132 | { |
135 | attach_module (PY_MODULE, methods); | 133 | _mu_py_attach_module (PY_MODULE, methods); |
136 | 134 | ||
137 | mu_registrar_record (MU_DEFAULT_RECORD); | 135 | mu_registrar_record (MU_DEFAULT_RECORD); |
138 | mu_registrar_set_default_record (MU_DEFAULT_RECORD); | 136 | mu_registrar_set_default_record (MU_DEFAULT_RECORD); | ... | ... |
... | @@ -18,8 +18,7 @@ | ... | @@ -18,8 +18,7 @@ |
18 | Boston, MA 02110-1301 USA | 18 | Boston, MA 02110-1301 USA |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include "c_api.h" | 21 | #include "libmu_py.h" |
22 | #include "stream-private.h" | ||
23 | 22 | ||
24 | #define PY_MODULE "stream" | 23 | #define PY_MODULE "stream" |
25 | #define PY_CSNAME "StreamType" | 24 | #define PY_CSNAME "StreamType" |
... | @@ -38,7 +37,7 @@ static PyTypeObject PyStreamType = { | ... | @@ -38,7 +37,7 @@ static PyTypeObject PyStreamType = { |
38 | PY_MODULE "." PY_CSNAME, /* tp_name */ | 37 | PY_MODULE "." PY_CSNAME, /* tp_name */ |
39 | sizeof (PyStream), /* tp_basicsize */ | 38 | sizeof (PyStream), /* tp_basicsize */ |
40 | 0, /* tp_itemsize */ | 39 | 0, /* tp_itemsize */ |
41 | (destructor)py_dealloc, /* tp_dealloc */ | 40 | (destructor)_py_dealloc, /* tp_dealloc */ |
42 | 0, /* tp_print */ | 41 | 0, /* tp_print */ |
43 | 0, /* tp_getattr; __getattr__ */ | 42 | 0, /* tp_getattr; __getattr__ */ |
44 | 0, /* tp_setattr; __setattr__ */ | 43 | 0, /* tp_setattr; __setattr__ */ |
... | @@ -55,12 +54,12 @@ static PyTypeObject PyStreamType = { | ... | @@ -55,12 +54,12 @@ static PyTypeObject PyStreamType = { |
55 | 0, /* tp_as_buffer */ | 54 | 0, /* tp_as_buffer */ |
56 | Py_TPFLAGS_DEFAULT, /* tp_flags */ | 55 | Py_TPFLAGS_DEFAULT, /* tp_flags */ |
57 | "", /* tp_doc */ | 56 | "", /* tp_doc */ |
58 | 0, /* tp_traverse */ | 57 | 0, /* tp_traverse */ |
59 | 0, /* tp_clear */ | 58 | 0, /* tp_clear */ |
60 | 0, /* tp_richcompare */ | 59 | 0, /* tp_richcompare */ |
61 | 0, /* tp_weaklistoffset */ | 60 | 0, /* tp_weaklistoffset */ |
62 | 0, /* tp_iter */ | 61 | 0, /* tp_iter */ |
63 | 0, /* tp_iternext */ | 62 | 0, /* tp_iternext */ |
64 | 0, /* tp_methods */ | 63 | 0, /* tp_methods */ |
65 | 0, /* tp_members */ | 64 | 0, /* tp_members */ |
66 | 0, /* tp_getset */ | 65 | 0, /* tp_getset */ |
... | @@ -393,15 +392,18 @@ static PyMethodDef methods[] = { | ... | @@ -393,15 +392,18 @@ static PyMethodDef methods[] = { |
393 | }; | 392 | }; |
394 | 393 | ||
395 | void | 394 | void |
396 | init_stream () | 395 | mu_py_init_stream (void) |
397 | { | 396 | { |
398 | PyObject *m; | ||
399 | |||
400 | PyStreamType.tp_new = PyType_GenericNew; | 397 | PyStreamType.tp_new = PyType_GenericNew; |
401 | if (PyType_Ready (&PyStreamType) < 0) | 398 | if (PyType_Ready (&PyStreamType) < 0) |
402 | return; | 399 | return; |
400 | } | ||
403 | 401 | ||
404 | if ((m = attach_module (PY_MODULE, methods))) | 402 | void |
403 | _mu_py_attach_stream (void) | ||
404 | { | ||
405 | PyObject *m; | ||
406 | if ((m = _mu_py_attach_module (PY_MODULE, methods))) | ||
405 | { | 407 | { |
406 | Py_INCREF (&PyStreamType); | 408 | Py_INCREF (&PyStreamType); |
407 | PyModule_AddObject (m, PY_CSNAME, (PyObject *)&PyStreamType); | 409 | PyModule_AddObject (m, PY_CSNAME, (PyObject *)&PyStreamType); | ... | ... |
... | @@ -18,8 +18,7 @@ | ... | @@ -18,8 +18,7 @@ |
18 | Boston, MA 02110-1301 USA | 18 | Boston, MA 02110-1301 USA |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include "c_api.h" | 21 | #include "libmu_py.h" |
22 | #include "url-private.h" | ||
23 | 22 | ||
24 | #define PY_MODULE "url" | 23 | #define PY_MODULE "url" |
25 | #define PY_CSNAME "UrlType" | 24 | #define PY_CSNAME "UrlType" |
... | @@ -38,7 +37,7 @@ static PyTypeObject PyUrlType = { | ... | @@ -38,7 +37,7 @@ static PyTypeObject PyUrlType = { |
38 | PY_MODULE "." PY_CSNAME, /* tp_name */ | 37 | PY_MODULE "." PY_CSNAME, /* tp_name */ |
39 | sizeof (PyUrl), /* tp_basicsize */ | 38 | sizeof (PyUrl), /* tp_basicsize */ |
40 | 0, /* tp_itemsize */ | 39 | 0, /* tp_itemsize */ |
41 | (destructor)py_dealloc, /* tp_dealloc */ | 40 | (destructor)_py_dealloc, /* tp_dealloc */ |
42 | 0, /* tp_print */ | 41 | 0, /* tp_print */ |
43 | 0, /* tp_getattr; __getattr__ */ | 42 | 0, /* tp_getattr; __getattr__ */ |
44 | 0, /* tp_setattr; __setattr__ */ | 43 | 0, /* tp_setattr; __setattr__ */ |
... | @@ -55,12 +54,12 @@ static PyTypeObject PyUrlType = { | ... | @@ -55,12 +54,12 @@ static PyTypeObject PyUrlType = { |
55 | 0, /* tp_as_buffer */ | 54 | 0, /* tp_as_buffer */ |
56 | Py_TPFLAGS_DEFAULT, /* tp_flags */ | 55 | Py_TPFLAGS_DEFAULT, /* tp_flags */ |
57 | "", /* tp_doc */ | 56 | "", /* tp_doc */ |
58 | 0, /* tp_traverse */ | 57 | 0, /* tp_traverse */ |
59 | 0, /* tp_clear */ | 58 | 0, /* tp_clear */ |
60 | 0, /* tp_richcompare */ | 59 | 0, /* tp_richcompare */ |
61 | 0, /* tp_weaklistoffset */ | 60 | 0, /* tp_weaklistoffset */ |
62 | 0, /* tp_iter */ | 61 | 0, /* tp_iter */ |
63 | 0, /* tp_iternext */ | 62 | 0, /* tp_iternext */ |
64 | 0, /* tp_methods */ | 63 | 0, /* tp_methods */ |
65 | 0, /* tp_members */ | 64 | 0, /* tp_members */ |
66 | 0, /* tp_getset */ | 65 | 0, /* tp_getset */ |
... | @@ -278,15 +277,18 @@ static PyMethodDef methods[] = { | ... | @@ -278,15 +277,18 @@ static PyMethodDef methods[] = { |
278 | }; | 277 | }; |
279 | 278 | ||
280 | void | 279 | void |
281 | init_url () | 280 | mu_py_init_url (void) |
282 | { | 281 | { |
283 | PyObject *m; | ||
284 | |||
285 | PyUrlType.tp_new = PyType_GenericNew; | 282 | PyUrlType.tp_new = PyType_GenericNew; |
286 | if (PyType_Ready (&PyUrlType) < 0) | 283 | if (PyType_Ready (&PyUrlType) < 0) |
287 | return; | 284 | return; |
285 | } | ||
288 | 286 | ||
289 | if ((m = attach_module (PY_MODULE, methods))) | 287 | void |
288 | _mu_py_attach_url (void) | ||
289 | { | ||
290 | PyObject *m; | ||
291 | if ((m = _mu_py_attach_module (PY_MODULE, methods))) | ||
290 | { | 292 | { |
291 | Py_INCREF (&PyUrlType); | 293 | Py_INCREF (&PyUrlType); |
292 | PyModule_AddObject (m, PY_CSNAME, (PyObject *)&PyUrlType); | 294 | PyModule_AddObject (m, PY_CSNAME, (PyObject *)&PyUrlType); | ... | ... |
... | @@ -18,8 +18,7 @@ | ... | @@ -18,8 +18,7 @@ |
18 | Boston, MA 02110-1301 USA | 18 | Boston, MA 02110-1301 USA |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include "c_api.h" | 21 | #include "libmu_py.h" |
22 | #include <mailutils/mutil.h> | ||
23 | 22 | ||
24 | #define PY_MODULE "util" | 23 | #define PY_MODULE "util" |
25 | 24 | ||
... | @@ -107,7 +106,7 @@ static PyMethodDef methods[] = { | ... | @@ -107,7 +106,7 @@ static PyMethodDef methods[] = { |
107 | }; | 106 | }; |
108 | 107 | ||
109 | void | 108 | void |
110 | init_util () | 109 | _mu_py_attach_util (void) |
111 | { | 110 | { |
112 | attach_module (PY_MODULE, methods); | 111 | _mu_py_attach_module (PY_MODULE, methods); |
113 | } | 112 | } | ... | ... |
-
Please register or sign in to post a comment