dcPython.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /**
  2. * PANDA 3D SOFTWARE
  3. * Copyright (c) Carnegie Mellon University. All rights reserved.
  4. *
  5. * All use of this software is subject to the terms of the revised BSD
  6. * license. You should have received a copy of this license along
  7. * with this source code in a file named "LICENSE."
  8. *
  9. * @file dcPython.h
  10. * @author drose
  11. * @date 2004-06-22
  12. */
  13. #ifndef DCPYTHON_H
  14. #define DCPYTHON_H
  15. // The only purpose of this file is to serve as a common place to put the
  16. // nonsense associated with #including <Python.h>.
  17. #ifdef HAVE_PYTHON
  18. #define PY_SSIZE_T_CLEAN 1
  19. #undef _POSIX_C_SOURCE
  20. #undef _XOPEN_SOURCE
  21. #include <Python.h>
  22. // Python 2.5 adds Py_ssize_t; earlier versions don't have it.
  23. #if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN)
  24. typedef int Py_ssize_t;
  25. #define PY_SSIZE_T_MAX INT_MAX
  26. #define PY_SSIZE_T_MIN INT_MIN
  27. #endif
  28. // Several interfaces in this module that use Python also require these header
  29. // files, so we might as well pick them up too.
  30. #include "datagram.h"
  31. #include "datagramIterator.h"
  32. #endif // HAVE_PYTHON
  33. #endif