You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
866 B

  1. /* Boolean object interface */
  2. #ifndef Py_BOOLOBJECT_H
  3. #define Py_BOOLOBJECT_H
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. PyAPI_DATA(PyTypeObject) PyBool_Type;
  8. #define PyBool_Check(x) Py_IS_TYPE(x, &PyBool_Type)
  9. /* Py_False and Py_True are the only two bools in existence.
  10. Don't forget to apply Py_INCREF() when returning either!!! */
  11. /* Don't use these directly */
  12. PyAPI_DATA(struct _longobject) _Py_FalseStruct, _Py_TrueStruct;
  13. /* Use these macros */
  14. #define Py_False ((PyObject *) &_Py_FalseStruct)
  15. #define Py_True ((PyObject *) &_Py_TrueStruct)
  16. /* Macros for returning Py_True or Py_False, respectively */
  17. #define Py_RETURN_TRUE return Py_NewRef(Py_True)
  18. #define Py_RETURN_FALSE return Py_NewRef(Py_False)
  19. /* Function to return a bool from a C long */
  20. PyAPI_FUNC(PyObject *) PyBool_FromLong(long);
  21. #ifdef __cplusplus
  22. }
  23. #endif
  24. #endif /* !Py_BOOLOBJECT_H */