File: _iconv_codec_compat.h

package info (click to toggle)
python-iconvcodec 1.1.2-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 156 kB
  • ctags: 200
  • sloc: ansic: 1,736; python: 251; perl: 114; makefile: 53
file content (80 lines) | stat: -rw-r--r-- 3,073 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/*
 * _iconv_codec_compat.h: Iconv Codec Compatiblility Support
 *
 * Copyright (C) 2003 Hye-Shik Chang. All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 * $Id: _iconv_codec_compat.h,v 1.1.1.1 2003/11/27 09:04:45 perky Exp $
 */

/* We don't support 2.0 and older */
#if PY_VERSION_HEX < 0x02010000
# error "iconv_codec requires python 2.1 or compatible"
#endif

/* PyDoc_VAR: For ~ Python 2.2 */
#if PY_VERSION_HEX < 0x02030000
# define PyDoc_VAR(name) static char name[]
# define PyDoc_STRVAR(name,str) PyDoc_VAR(name) = PyDoc_STR(str)
# define PyDoc_STR(str) str
#endif

/* PEP293 Codec Error Callbacks are only for Python 2.3 and over */
#if PY_VERSION_HEX < 0x02030000
# define LACKS_ERROR_CALLBACKS      1
#endif

/* Python 2.1 doesn't have sth */
#if PY_VERSION_HEX < 0x02020000
# define Py_USING_UNICODE           1
# define Py_UNICODE_SIZE            2
# define LACKS_PYSTRING_FROMFORMAT  1
# define OLD_STYLE_TYPE             1
# define METH_NOARGS                METH_VARARGS
# define OLD_GETATTR_DEF(prefix)                                \
    static PyObject *                                           \
    prefix##_getattr(PyObject *self, char *name)                \
    {                                                           \
        return Py_FindMethod(prefix##_methods, self, name);     \
    }
# define GETATTR_FUNC(prefix)       prefix##_getattr
# define GETATTRO_FUNC              0
#else
# define OLD_GETATTR_DEF(prefix)
# define GETATTR_FUNC(prefix)       0
# ifdef __MINGW32__ 
__inline static PyObject* __dummy_getattro(PyObject* self, PyObject* args) 
{ 
   return PyObject_GenericGetAttr(self, args); 
} 
#  define GETATTRO_FUNC             __dummy_getattro
# else
#  define GETATTRO_FUNC             PyObject_GenericGetAttr
# endif
#endif



/*
 * ex: ts=8 sts=4 et
 */