Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | #ifndef Py_BOOLOBJECT_H |
2 | #define Py_BOOLOBJECT_H | |
3 | #ifdef __cplusplus | |
4 | extern "C" { | |
5 | #endif | |
6 | ||
7 | ||
8 | typedef PyIntObject PyBoolObject; | |
9 | ||
10 | PyAPI_DATA(PyTypeObject) PyBool_Type; | |
11 | ||
12 | #define PyBool_Check(x) ((x)->ob_type == &PyBool_Type) | |
13 | ||
14 | /* Py_False and Py_True are the only two bools in existence. | |
15 | Don't forget to apply Py_INCREF() when returning either!!! */ | |
16 | ||
17 | /* Don't use these directly */ | |
18 | PyAPI_DATA(PyIntObject) _Py_ZeroStruct, _Py_TrueStruct; | |
19 | ||
20 | /* Use these macros */ | |
21 | #define Py_False ((PyObject *) &_Py_ZeroStruct) | |
22 | #define Py_True ((PyObject *) &_Py_TrueStruct) | |
23 | ||
24 | /* Macros for returning Py_True or Py_False, respectively */ | |
25 | #define Py_RETURN_TRUE return Py_INCREF(Py_True), Py_True | |
26 | #define Py_RETURN_FALSE return Py_INCREF(Py_False), Py_False | |
27 | ||
28 | /* Function to return a bool from a C long */ | |
29 | PyAPI_FUNC(PyObject *) PyBool_FromLong(long); | |
30 | ||
31 | #ifdef __cplusplus | |
32 | } | |
33 | #endif | |
34 | #endif /* !Py_BOOLOBJECT_H */ |