annotate cos/python/Include/boolobject.h @ 92:0c4bdbf0aead

improvements?
author windel
date Sat, 15 Dec 2012 23:56:26 +0100
parents 7f74363f4c82
children
rev   line source
27
7f74363f4c82 Added some files for the python port
windel
parents:
diff changeset
1 /* Boolean object interface */
7f74363f4c82 Added some files for the python port
windel
parents:
diff changeset
2
7f74363f4c82 Added some files for the python port
windel
parents:
diff changeset
3 #ifndef Py_BOOLOBJECT_H
7f74363f4c82 Added some files for the python port
windel
parents:
diff changeset
4 #define Py_BOOLOBJECT_H
7f74363f4c82 Added some files for the python port
windel
parents:
diff changeset
5
7f74363f4c82 Added some files for the python port
windel
parents:
diff changeset
6 PyAPI_DATA(PyTypeObject) PyBool_Type;
7f74363f4c82 Added some files for the python port
windel
parents:
diff changeset
7
7f74363f4c82 Added some files for the python port
windel
parents:
diff changeset
8 #define PyBool_Check(x) (Py_TYPE(x) == &PyBool_Type)
7f74363f4c82 Added some files for the python port
windel
parents:
diff changeset
9
7f74363f4c82 Added some files for the python port
windel
parents:
diff changeset
10 /* Py_False and Py_True are the only two bools in existence.
7f74363f4c82 Added some files for the python port
windel
parents:
diff changeset
11 Don't forget to apply Py_INCREF() when returning either!!! */
7f74363f4c82 Added some files for the python port
windel
parents:
diff changeset
12
7f74363f4c82 Added some files for the python port
windel
parents:
diff changeset
13 /* Don't use these directly */
7f74363f4c82 Added some files for the python port
windel
parents:
diff changeset
14 PyAPI_DATA(struct _longobject) _Py_FalseStruct, _Py_TrueStruct;
7f74363f4c82 Added some files for the python port
windel
parents:
diff changeset
15
7f74363f4c82 Added some files for the python port
windel
parents:
diff changeset
16 /* Use these macros */
7f74363f4c82 Added some files for the python port
windel
parents:
diff changeset
17 #define Py_False ((PyObject *) &_Py_FalseStruct)
7f74363f4c82 Added some files for the python port
windel
parents:
diff changeset
18 #define Py_True ((PyObject *) &_Py_TrueStruct)
7f74363f4c82 Added some files for the python port
windel
parents:
diff changeset
19
7f74363f4c82 Added some files for the python port
windel
parents:
diff changeset
20 /* Macros for returning Py_True or Py_False, respectively */
7f74363f4c82 Added some files for the python port
windel
parents:
diff changeset
21 #define Py_RETURN_TRUE return Py_INCREF(Py_True), Py_True
7f74363f4c82 Added some files for the python port
windel
parents:
diff changeset
22 #define Py_RETURN_FALSE return Py_INCREF(Py_False), Py_False
7f74363f4c82 Added some files for the python port
windel
parents:
diff changeset
23
7f74363f4c82 Added some files for the python port
windel
parents:
diff changeset
24 /* Function to return a bool from a C long */
7f74363f4c82 Added some files for the python port
windel
parents:
diff changeset
25 PyAPI_FUNC(PyObject *) PyBool_FromLong(long);
7f74363f4c82 Added some files for the python port
windel
parents:
diff changeset
26
7f74363f4c82 Added some files for the python port
windel
parents:
diff changeset
27 #endif /* !Py_BOOLOBJECT_H */