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