Show More
@@ -1,63 +1,64 | |||
|
1 | 1 | /* |
|
2 | 2 | util.h - utility functions for interfacing with the various python APIs. |
|
3 | 3 | |
|
4 | 4 | This software may be used and distributed according to the terms of |
|
5 | 5 | the GNU General Public License, incorporated herein by reference. |
|
6 | 6 | */ |
|
7 | 7 | |
|
8 | 8 | #ifndef _HG_UTIL_H_ |
|
9 | 9 | #define _HG_UTIL_H_ |
|
10 | 10 | |
|
11 | 11 | #if PY_MAJOR_VERSION >= 3 |
|
12 | 12 | |
|
13 | 13 | #define IS_PY3K |
|
14 | 14 | #define PyInt_FromLong PyLong_FromLong |
|
15 | #define PyInt_AsLong PyLong_AsLong | |
|
15 | 16 | |
|
16 | 17 | #endif /* PY_MAJOR_VERSION */ |
|
17 | 18 | |
|
18 | 19 | /* Backports from 2.6 */ |
|
19 | 20 | #if PY_VERSION_HEX < 0x02060000 |
|
20 | 21 | |
|
21 | 22 | #define Py_TYPE(ob) (ob)->ob_type |
|
22 | 23 | #define Py_SIZE(ob) (ob)->ob_size |
|
23 | 24 | #define PyVarObject_HEAD_INIT(type, size) PyObject_HEAD_INIT(type) size, |
|
24 | 25 | |
|
25 | 26 | /* Shamelessly stolen from bytesobject.h */ |
|
26 | 27 | #define PyBytesObject PyStringObject |
|
27 | 28 | #define PyBytes_Type PyString_Type |
|
28 | 29 | |
|
29 | 30 | #define PyBytes_Check PyString_Check |
|
30 | 31 | #define PyBytes_CheckExact PyString_CheckExact |
|
31 | 32 | #define PyBytes_CHECK_INTERNED PyString_CHECK_INTERNED |
|
32 | 33 | #define PyBytes_AS_STRING PyString_AS_STRING |
|
33 | 34 | #define PyBytes_GET_SIZE PyString_GET_SIZE |
|
34 | 35 | #define Py_TPFLAGS_BYTES_SUBCLASS Py_TPFLAGS_STRING_SUBCLASS |
|
35 | 36 | |
|
36 | 37 | #define PyBytes_FromStringAndSize PyString_FromStringAndSize |
|
37 | 38 | #define PyBytes_FromString PyString_FromString |
|
38 | 39 | #define PyBytes_FromFormatV PyString_FromFormatV |
|
39 | 40 | #define PyBytes_FromFormat PyString_FromFormat |
|
40 | 41 | #define PyBytes_Size PyString_Size |
|
41 | 42 | #define PyBytes_AsString PyString_AsString |
|
42 | 43 | #define PyBytes_Repr PyString_Repr |
|
43 | 44 | #define PyBytes_Concat PyString_Concat |
|
44 | 45 | #define PyBytes_ConcatAndDel PyString_ConcatAndDel |
|
45 | 46 | #define _PyBytes_Resize _PyString_Resize |
|
46 | 47 | #define _PyBytes_Eq _PyString_Eq |
|
47 | 48 | #define PyBytes_Format PyString_Format |
|
48 | 49 | #define _PyBytes_FormatLong _PyString_FormatLong |
|
49 | 50 | #define PyBytes_DecodeEscape PyString_DecodeEscape |
|
50 | 51 | #define _PyBytes_Join _PyString_Join |
|
51 | 52 | #define PyBytes_Decode PyString_Decode |
|
52 | 53 | #define PyBytes_Encode PyString_Encode |
|
53 | 54 | #define PyBytes_AsEncodedObject PyString_AsEncodedObject |
|
54 | 55 | #define PyBytes_AsEncodedString PyString_AsEncodedString |
|
55 | 56 | #define PyBytes_AsDecodedObject PyString_AsDecodedObject |
|
56 | 57 | #define PyBytes_AsDecodedString PyString_AsDecodedString |
|
57 | 58 | #define PyBytes_AsStringAndSize PyString_AsStringAndSize |
|
58 | 59 | #define _PyBytes_InsertThousandsGrouping _PyString_InsertThousandsGrouping |
|
59 | 60 | |
|
60 | 61 | #endif /* PY_VERSION_HEX */ |
|
61 | 62 | |
|
62 | 63 | #endif /* _HG_UTIL_H_ */ |
|
63 | 64 |
General Comments 0
You need to be logged in to leave comments.
Login now