1 /** 
2   Mirror _boolobject.h
3   */
4 module deimos.python.boolobject;
5 
6 import deimos.python.pyport;
7 import deimos.python.object;
8 import deimos.python.intobject;
9 import deimos.python.longintrepr;
10 
11 extern(C):
12 // Python-header-file: Include/boolobject.h:
13 
14 version(Python_3_0_Or_Later) {
15 }else{
16     alias PyIntObject PyBoolObject;
17 }
18 
19 /// _
20 mixin(PyAPI_DATA!"PyTypeObject PyBool_Type");
21 
22 // D translation of C macro:
23 /// _
24 int PyBool_Check()(PyObject* x) {
25     return x.ob_type == &PyBool_Type;
26 }
27 
28 version(Python_3_0_Or_Later) {
29     mixin(PyAPI_DATA!"PyLongObject _Py_FalseStruct");
30     mixin(PyAPI_DATA!"PyLongObject _Py_TrueStruct");
31 }else {
32     mixin(PyAPI_DATA!"PyIntObject _Py_ZeroStruct");
33     mixin(PyAPI_DATA!"PyIntObject _Py_TrueStruct");
34 }
35 
36 /// _
37 @property Borrowed!PyObject* Py_True()() {
38     return cast(Borrowed!PyObject*) &_Py_TrueStruct;
39 }
40 /// _
41 @property Borrowed!PyObject* Py_False()() {
42     version(Python_3_0_Or_Later) {
43         return cast(Borrowed!PyObject*) &_Py_FalseStruct;
44     }else{
45         return cast(Borrowed!PyObject*) &_Py_ZeroStruct;
46     }
47 }
48 
49 /** Function to return a bool from a C long */
50 PyObject* PyBool_FromLong(C_long);
51 
52