blob: e7a4e607960cf6fdfc379c5796fe4c4635397328 [file] [log] [blame]
Guido van Rossum5f820362002-04-03 23:01:45 +00001/* Boolean object interface */
2
Mark Hammond303d05d2002-04-06 03:58:41 +00003#ifndef Py_BOOLOBJECT_H
4#define Py_BOOLOBJECT_H
5#ifdef __cplusplus
6extern "C" {
7#endif
8
9
Guido van Rossum5f820362002-04-03 23:01:45 +000010typedef PyIntObject PyBoolObject;
11
Mark Hammond91a681d2002-08-12 07:21:58 +000012PyAPI_DATA(PyTypeObject) PyBool_Type;
Guido van Rossum5f820362002-04-03 23:01:45 +000013
14#define PyBool_Check(x) ((x)->ob_type == &PyBool_Type)
15
16/* Py_False and Py_True are the only two bools in existence.
17Don't forget to apply Py_INCREF() when returning either!!! */
18
19/* Don't use these directly */
Mark Hammond91a681d2002-08-12 07:21:58 +000020PyAPI_DATA(PyIntObject) _Py_ZeroStruct, _Py_TrueStruct;
Guido van Rossum5f820362002-04-03 23:01:45 +000021
22/* Use these macros */
23#define Py_False ((PyObject *) &_Py_ZeroStruct)
24#define Py_True ((PyObject *) &_Py_TrueStruct)
25
26/* Function to return a bool from a C long */
Mark Hammond91a681d2002-08-12 07:21:58 +000027PyAPI_FUNC(PyObject *) PyBool_FromLong(long);
Mark Hammond303d05d2002-04-06 03:58:41 +000028
29#ifdef __cplusplus
30}
31#endif
32#endif /* !Py_BOOLOBJECT_H */