python22_fixed.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. // This file is a modified version of Python 2.2/2.2.1 Python.h. As
  2. // such it is:
  3. //
  4. // Copyright (c) 2001, 2002 Python Software Foundation; All Rights
  5. // Reserved
  6. //
  7. // boostinspect:nolicense (don't complain about the lack of a Boost license)
  8. //
  9. // Changes from the original:
  10. // 1. #includes <unistd.h> for Python 2.2.1
  11. // 2. Provides missing extern "C" wrapper for "iterobject.h" and "descrobject.h".
  12. //
  13. // Changes marked with "Boost.Python modification"
  14. #ifndef Py_PYTHON_H
  15. #define Py_PYTHON_H
  16. /* Since this is a "meta-include" file, no #ifdef __cplusplus / extern "C" { */
  17. /* Enable compiler features; switching on C lib defines doesn't work
  18. here, because the symbols haven't necessarily been defined yet. */
  19. #ifndef _GNU_SOURCE
  20. # define _GNU_SOURCE 1
  21. #endif
  22. /* Forcing SUSv2 compatibility still produces problems on some
  23. platforms, True64 and SGI IRIX begin two of them, so for now the
  24. define is switched off. */
  25. #if 0
  26. #ifndef _XOPEN_SOURCE
  27. # define _XOPEN_SOURCE 500
  28. #endif
  29. #endif
  30. /* Include nearly all Python header files */
  31. #include "patchlevel.h"
  32. #include "pyconfig.h"
  33. #ifdef HAVE_LIMITS_H
  34. #include <limits.h>
  35. #endif
  36. /* pyconfig.h may or may not define DL_IMPORT */
  37. #ifndef DL_IMPORT /* declarations for DLL import/export */
  38. #define DL_IMPORT(RTYPE) RTYPE
  39. #endif
  40. #ifndef DL_EXPORT /* declarations for DLL import/export */
  41. #define DL_EXPORT(RTYPE) RTYPE
  42. #endif
  43. #if defined(__sgi) && defined(WITH_THREAD) && !defined(_SGI_MP_SOURCE)
  44. #define _SGI_MP_SOURCE
  45. #endif
  46. #include <stdio.h>
  47. #ifndef NULL
  48. # error "Python.h requires that stdio.h define NULL."
  49. #endif
  50. #include <string.h>
  51. #include <errno.h>
  52. #ifdef HAVE_STDLIB_H
  53. #include <stdlib.h>
  54. #endif
  55. #if PY_MICRO_VERSION == 1 // Boost.Python modification: emulate Python 2.2
  56. #ifdef HAVE_UNISTD_H
  57. #include <unistd.h>
  58. #endif
  59. #endif // Boost.Python modification: emulate Python 2.2
  60. /* CAUTION: Build setups should ensure that NDEBUG is defined on the
  61. * compiler command line when building Python in release mode; else
  62. * assert() calls won't be removed.
  63. */
  64. #include <assert.h>
  65. #include "pyport.h"
  66. #include "pymem.h"
  67. #include "object.h"
  68. #include "objimpl.h"
  69. #include "pydebug.h"
  70. #include "unicodeobject.h"
  71. #include "intobject.h"
  72. #include "longobject.h"
  73. #include "floatobject.h"
  74. #ifndef WITHOUT_COMPLEX
  75. #include "complexobject.h"
  76. #endif
  77. #include "rangeobject.h"
  78. #include "stringobject.h"
  79. #include "bufferobject.h"
  80. #include "tupleobject.h"
  81. #include "listobject.h"
  82. #include "dictobject.h"
  83. #include "methodobject.h"
  84. #include "moduleobject.h"
  85. #include "funcobject.h"
  86. #include "classobject.h"
  87. #include "fileobject.h"
  88. #include "cobject.h"
  89. #include "traceback.h"
  90. #include "sliceobject.h"
  91. #include "cellobject.h"
  92. extern "C" { // Boost.Python modification: provide missing extern "C"
  93. #include "iterobject.h"
  94. #include "descrobject.h"
  95. } // Boost.Python modification: provide missing extern "C"
  96. #include "weakrefobject.h"
  97. #include "codecs.h"
  98. #include "pyerrors.h"
  99. #include "pystate.h"
  100. #include "modsupport.h"
  101. #include "pythonrun.h"
  102. #include "ceval.h"
  103. #include "sysmodule.h"
  104. #include "intrcheck.h"
  105. #include "import.h"
  106. #include "abstract.h"
  107. #define PyArg_GetInt(v, a) PyArg_Parse((v), "i", (a))
  108. #define PyArg_NoArgs(v) PyArg_Parse(v, "")
  109. /* Convert a possibly signed character to a nonnegative int */
  110. /* XXX This assumes characters are 8 bits wide */
  111. #ifdef __CHAR_UNSIGNED__
  112. #define Py_CHARMASK(c) (c)
  113. #else
  114. #define Py_CHARMASK(c) ((c) & 0xff)
  115. #endif
  116. #include "pyfpe.h"
  117. /* These definitions must match corresponding definitions in graminit.h.
  118. There's code in compile.c that checks that they are the same. */
  119. #define Py_single_input 256
  120. #define Py_file_input 257
  121. #define Py_eval_input 258
  122. #ifdef HAVE_PTH
  123. /* GNU pth user-space thread support */
  124. #include <pth.h>
  125. #endif
  126. #endif /* !Py_PYTHON_H */