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