Debian Codegraph @

Xpjproject/pjsip-apps/src/python/python3_compat.h

raw symbols SCIP
1 /*
2 * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
3 * Copyright (C) 2003-2008 Benny Prijono <[email protected]>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program 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
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20
21 #ifndef __PY_PYTHON_3_COMPAT__
22 #define __PY_PYTHON_3_COMPAT__
23
24 #if PY_MAJOR_VERSION > 2
25
26 #define PY_SSIZE_T_CLEAN
27
28 #define PyEval_InitThreads Py_Initialize
29 #define Py_InitModule3( name, methods, doc ) ( PyModule_Create( &py_pjsua_module ) )
30
31 #if PY_MINOR_VERSION >= 10
32 #define DL_EXPORT( x ) PyObject*
33 #define init_pjsua( x ) PyInit__pjsua( x )
34 #define INIT_RETURN ( m )
35 #else
36 #define DL_EXPORT( x ) void
37 #define INIT_RETURN
38 #endif
39
40 #define PyString_FromStringAndSize( x, y ) PyUnicode_FromStringAndSize( x, y )
41 #define PyString_Check( x ) PyUnicode_Check( x )
42 #define PyString_FromString( x ) PyUnicode_FromString( x )
43 #define PyString_AsString( x ) ( ( char * )PyUnicode_AsUTF8( x ) )
44 #define PyString_AS_STRING( x ) ( ( char * )PyUnicode_AsUTF8( x ) )
45 #define PyString_GET_SIZE( x ) PyUnicode_GetLength( x )
46 #define PyString_Size( x ) PyUnicode_GetLength( x )
47
48 #define PyInt_AsLong( x ) PyLong_AsLong( x )
49
50 #endif // PY_MAJOR_VERSION > 2
51
52 #endif // __PY_PYTHON_3_COMPAT__