Chris@87: /* Boolean object interface */ Chris@87: Chris@87: #ifndef Py_BOOLOBJECT_H Chris@87: #define Py_BOOLOBJECT_H Chris@87: #ifdef __cplusplus Chris@87: extern "C" { Chris@87: #endif Chris@87: Chris@87: Chris@87: typedef PyIntObject PyBoolObject; Chris@87: Chris@87: PyAPI_DATA(PyTypeObject) PyBool_Type; Chris@87: Chris@87: #define PyBool_Check(x) (Py_TYPE(x) == &PyBool_Type) Chris@87: Chris@87: /* Py_False and Py_True are the only two bools in existence. Chris@87: Don't forget to apply Py_INCREF() when returning either!!! */ Chris@87: Chris@87: /* Don't use these directly */ Chris@87: PyAPI_DATA(PyIntObject) _Py_ZeroStruct, _Py_TrueStruct; Chris@87: Chris@87: /* Use these macros */ Chris@87: #define Py_False ((PyObject *) &_Py_ZeroStruct) Chris@87: #define Py_True ((PyObject *) &_Py_TrueStruct) Chris@87: Chris@87: /* Macros for returning Py_True or Py_False, respectively */ Chris@87: #define Py_RETURN_TRUE return Py_INCREF(Py_True), Py_True Chris@87: #define Py_RETURN_FALSE return Py_INCREF(Py_False), Py_False Chris@87: Chris@87: /* Function to return a bool from a C long */ Chris@87: PyAPI_FUNC(PyObject *) PyBool_FromLong(long); Chris@87: Chris@87: #ifdef __cplusplus Chris@87: } Chris@87: #endif Chris@87: #endif /* !Py_BOOLOBJECT_H */