10
  	   	0  	   0  	   0  +   laʀnZjbѿ"q_I|+ 3    #ifndef HAS_ETREE_DEFS_H
#define HAS_ETREE_DEFS_H

/* quick check for Python/libxml2/libxslt devel setup */
#include "Python.h"
#ifndef PY_VERSION_HEX
#  error the development package of Python (header files etc.) is not installed correctly
#endif
#include "libxml/xmlversion.h"
#ifndef LIBXML_VERSION
#  error the development package of libxml2 (header files etc.) is not installed correctly
#endif
#include "libxslt/xsltconfig.h"
#ifndef LIBXSLT_VERSION
#  error the development package of libxslt (header files etc.) is not installed correctly
#endif


/* v_arg functions */
#define va_int(ap)     va_arg(ap, int)
#define va_charptr(ap) va_arg(ap, char *)

#ifdef PYPY_VERSION
#    define IS_PYPY 1
#else
#    define IS_PYPY 0
#endif

#if PY_VERSION_HEX >= 0x03000000
#  define IS_PYTHON3 1
#else
#  define IS_PYTHON3 0
#endif

#if IS_PYTHON3
#undef LXML_UNICODE_STRINGS
#define LXML_UNICODE_STRINGS 1
#else
#ifndef LXML_UNICODE_STRINGS
#define LXML_UNICODE_STRINGS 0
#endif
#endif

#if !IS_PYPY
#  define PyWeakref_LockObject(obj)          (NULL)
#endif

/* Threading can crash under Python <= 2.4.1 and is not currently supported by PyPy */
#if PY_VERSION_HEX < 0x02040200 || IS_PYPY
#  ifndef WITHOUT_THREADING
#    define WITHOUT_THREADING
#  endif
#endif

/* Python 3 doesn't have PyFile_*() anymore */
#if PY_VERSION_HEX >= 0x03000000
#  define PyFile_AsFile(o)                   (NULL)
#else
#if IS_PYPY
#  undef PyFile_AsFile
#  define PyFile_AsFile(o)                   (NULL)
#  undef PyUnicode_FromFormat
#  define PyUnicode_FromFormat(s, a, b)      (NULL)
#else
#if PY_VERSION_HEX < 0x02060000
/* Cython defines these already, but we may not be compiling in Cython code */
#ifndef PyBytes_CheckExact
#  define PyBytes_CheckExact(o)              PyString_CheckExact(o)
#  define PyBytes_Check(o)                   PyString_Check(o)
#  define PyBytes_FromStringAndSize(s, len)  PyString_FromStringAndSize(s, len)
#  define PyBytes_FromFormat                 PyString_FromFormat
#  define PyBytes_GET_SIZE(s)                PyString_GET_SIZE(s)
#  define PyBytes_AS_STRING(s)               PyString_AS_STRING(s)
#endif
/* we currently only use three parameters - MSVC can't compile (s, ...) */
#  define PyUnicode_FromFormat(s, a, b)      (NULL)
#endif
#endif
#endif

/* PySlice_GetIndicesEx() has wrong signature in Py<=3.1 */
#if PY_VERSION_HEX >= 0x03020000
#  define _lx_PySlice_GetIndicesEx(o, l, b, e, s, sl) PySlice_GetIndicesEx(o, l, b, e, s, sl)
#else
#  define _lx_PySlice_GetIndicesEx(o, l, b, e, s, sl) PySlice_GetIndicesEx(((PySliceObject*)o), l, b, e, s, sl)
#endif

#ifdef WITHOUT_THREADING
#  define PyEval_SaveThread() (NULL)
#  define PyEval_RestoreThread(state)
#  define PyGILState_Ensure() (PyGILState_UNLOCKED)
#  define PyGILState_Release(state)
#  undef  Py_UNBLOCK_THREADS
#  define Py_UNBLOCK_THREADS
#  undef  Py_BLOCK_THREADS
#  define Py_BLOCK_THREADS
#endif

#ifdef WITHOUT_THREADING
#  define ENABLE_THREADING 0
#else
#  define ENABLE_THREADING 1
#endif

/* libxml2 version specific setup */
#if LIBXML_VERSION < 20621
/* (X|HT)ML_PARSE_COMPACT were added in libxml2 2.6.21 */
#  define XML_PARSE_COMPACT  1 << 16
#  define HTML_PARSE_COMPACT XML_PARSE_COMPACT

/* HTML_PARSE_RECOVER was added in libxml2 2.6.21 */
#  define HTML_PARSE_RECOVER XML_PARSE_RECOVER
#endif

#if LIBXML_VERSION < 20700
/* These were added in libxml2 2.7.0 */
#  define XML_PARSE_OLD10      1 << 17
#  define XML_PARSE_NOBASEFIX  1 << 18
#  define XML_PARSE_HUGE       1 << 19
#  define xmlMemDisplayLast(f,d)
#endif

#if LIBXML_VERSION < 20704
/* FIXME: hack to make new error reporting compile in old libxml2 versions */
#  define xmlStructuredErrorContext NULL
#endif

/* added to xmlsave API in libxml2 2.6.23 */
#if LIBXML_VERSION < 20623
#  define xmlSaveToBuffer(buffer, encoding, options)
#endif

/* added to xmlsave API in libxml2 2.6.22 */
#if LIBXML_VERSION < 20622
#  define XML_SAVE_NO_EMPTY   1<<2  /* no empty tags */
#  define XML_SAVE_NO_XHT