annotate Include/boolobject.h @ 28646:193b8aec00ce legacy-trunk

Changes from Jonathan Riehl to allow his pgen extension (PEP 269) to work. This includes some more code that used to be part of pgen in the main parser; I'm okay with that. I'll see if the Windows build needs work next.
author Guido van Rossum <guido@python.org>
date Thu, 17 Apr 2003 14:55:42 +0000
parents c1eb668525e1
children 7dfdf9e8d95d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
22787
028ebc8fb390 Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff changeset
1 /* Boolean object interface */
028ebc8fb390 Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff changeset
2
22861
a6527d1ee474 Add standard header preamble and footer, a-la intobject.h. Main purpose is extern "C" for C++ programs.
Mark Hammond <mhammond@skippinet.com.au>
parents: 22787
diff changeset
3 #ifndef Py_BOOLOBJECT_H
a6527d1ee474 Add standard header preamble and footer, a-la intobject.h. Main purpose is extern "C" for C++ programs.
Mark Hammond <mhammond@skippinet.com.au>
parents: 22787
diff changeset
4 #define Py_BOOLOBJECT_H
a6527d1ee474 Add standard header preamble and footer, a-la intobject.h. Main purpose is extern "C" for C++ programs.
Mark Hammond <mhammond@skippinet.com.au>
parents: 22787
diff changeset
5 #ifdef __cplusplus
a6527d1ee474 Add standard header preamble and footer, a-la intobject.h. Main purpose is extern "C" for C++ programs.
Mark Hammond <mhammond@skippinet.com.au>
parents: 22787
diff changeset
6 extern "C" {
a6527d1ee474 Add standard header preamble and footer, a-la intobject.h. Main purpose is extern "C" for C++ programs.
Mark Hammond <mhammond@skippinet.com.au>
parents: 22787
diff changeset
7 #endif
a6527d1ee474 Add standard header preamble and footer, a-la intobject.h. Main purpose is extern "C" for C++ programs.
Mark Hammond <mhammond@skippinet.com.au>
parents: 22787
diff changeset
8
a6527d1ee474 Add standard header preamble and footer, a-la intobject.h. Main purpose is extern "C" for C++ programs.
Mark Hammond <mhammond@skippinet.com.au>
parents: 22787
diff changeset
9
22787
028ebc8fb390 Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff changeset
10 typedef PyIntObject PyBoolObject;
028ebc8fb390 Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff changeset
11
24752
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 23364
diff changeset
12 PyAPI_DATA(PyTypeObject) PyBool_Type;
22787
028ebc8fb390 Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff changeset
13
028ebc8fb390 Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff changeset
14 #define PyBool_Check(x) ((x)->ob_type == &PyBool_Type)
028ebc8fb390 Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff changeset
15
028ebc8fb390 Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff changeset
16 /* Py_False and Py_True are the only two bools in existence.
028ebc8fb390 Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff changeset
17 Don't forget to apply Py_INCREF() when returning either!!! */
028ebc8fb390 Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff changeset
18
028ebc8fb390 Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff changeset
19 /* Don't use these directly */
24752
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 23364
diff changeset
20 PyAPI_DATA(PyIntObject) _Py_ZeroStruct, _Py_TrueStruct;
22787
028ebc8fb390 Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff changeset
21
028ebc8fb390 Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff changeset
22 /* Use these macros */
028ebc8fb390 Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff changeset
23 #define Py_False ((PyObject *) &_Py_ZeroStruct)
028ebc8fb390 Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff changeset
24 #define Py_True ((PyObject *) &_Py_TrueStruct)
028ebc8fb390 Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff changeset
25
028ebc8fb390 Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff changeset
26 /* Function to return a bool from a C long */
24752
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 23364
diff changeset
27 PyAPI_FUNC(PyObject *) PyBool_FromLong(long);
22861
a6527d1ee474 Add standard header preamble and footer, a-la intobject.h. Main purpose is extern "C" for C++ programs.
Mark Hammond <mhammond@skippinet.com.au>
parents: 22787
diff changeset
28
a6527d1ee474 Add standard header preamble and footer, a-la intobject.h. Main purpose is extern "C" for C++ programs.
Mark Hammond <mhammond@skippinet.com.au>
parents: 22787
diff changeset
29 #ifdef __cplusplus
a6527d1ee474 Add standard header preamble and footer, a-la intobject.h. Main purpose is extern "C" for C++ programs.
Mark Hammond <mhammond@skippinet.com.au>
parents: 22787
diff changeset
30 }
a6527d1ee474 Add standard header preamble and footer, a-la intobject.h. Main purpose is extern "C" for C++ programs.
Mark Hammond <mhammond@skippinet.com.au>
parents: 22787
diff changeset
31 #endif
a6527d1ee474 Add standard header preamble and footer, a-la intobject.h. Main purpose is extern "C" for C++ programs.
Mark Hammond <mhammond@skippinet.com.au>
parents: 22787
diff changeset
32 #endif /* !Py_BOOLOBJECT_H */