annotate Include/intobject.h @ 27998:e27f58a50737 legacy-trunk

SF bug #690377: Dud footnote reference in distutils docs
author Raymond Hettinger <python@rcn.com>
date Fri, 21 Feb 2003 02:47:09 +0000
parents bda4185670cc
children 28a2975514cd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
145
853b736a6a9e Added copyright notice.
Guido van Rossum <guido@python.org>
parents: 6
diff changeset
1
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2 /* Integer object interface */
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
3
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
4 /*
2129
05360cd616ae The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents: 2058
diff changeset
5 PyIntObject represents a (long) integer. This is an immutable object;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
6 an integer cannot change its value after creation.
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
7
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
8 There are functions to create new integer objects, to test an object
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
9 for integer-ness, and to get the integer value. The latter functions
2129
05360cd616ae The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents: 2058
diff changeset
10 returns -1 and sets errno to EBADF if the object is not an PyIntObject.
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
11 None of the functions should be applied to nil objects.
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
12
2129
05360cd616ae The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents: 2058
diff changeset
13 The type PyIntObject is (unfortunately) exposed here so we can declare
05360cd616ae The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents: 2058
diff changeset
14 _Py_TrueStruct and _Py_ZeroStruct below; don't use this.
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
15 */
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
16
13444
5709ddba423c ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
17 #ifndef Py_INTOBJECT_H
5709ddba423c ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
18 #define Py_INTOBJECT_H
5709ddba423c ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
19 #ifdef __cplusplus
5709ddba423c ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
20 extern "C" {
5709ddba423c ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
21 #endif
5709ddba423c ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
22
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
23 typedef struct {
13444
5709ddba423c ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
24 PyObject_HEAD
5709ddba423c ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
25 long ob_ival;
2129
05360cd616ae The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents: 2058
diff changeset
26 } PyIntObject;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
27
24752
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 22785
diff changeset
28 PyAPI_DATA(PyTypeObject) PyInt_Type;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
29
19550
19d271f297dc Make the PyXXX_Check() macros for the numeric types inheritance-aware.
Guido van Rossum <guido@python.org>
parents: 19343
diff changeset
30 #define PyInt_Check(op) PyObject_TypeCheck(op, &PyInt_Type)
19837
5158e4789459 SF bug #460020: bug or feature: unicode() and subclasses.
Tim Peters <tim.peters@gmail.com>
parents: 19550
diff changeset
31 #define PyInt_CheckExact(op) ((op)->ob_type == &PyInt_Type)
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
32
24752
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 22785
diff changeset
33 PyAPI_FUNC(PyObject *) PyInt_FromString(char*, char**, int);
19343
7257e87e0720 Patch #445762: Support --disable-unicode
Martin v. Löwis <martin@v.loewis.de>
parents: 14375
diff changeset
34 #ifdef Py_USING_UNICODE
24752
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 22785
diff changeset
35 PyAPI_FUNC(PyObject *) PyInt_FromUnicode(Py_UNICODE*, int, int);
19343
7257e87e0720 Patch #445762: Support --disable-unicode
Martin v. Löwis <martin@v.loewis.de>
parents: 14375
diff changeset
36 #endif
24752
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 22785
diff changeset
37 PyAPI_FUNC(PyObject *) PyInt_FromLong(long);
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 22785
diff changeset
38 PyAPI_FUNC(long) PyInt_AsLong(PyObject *);
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 22785
diff changeset
39 PyAPI_FUNC(long) PyInt_GetMax(void);
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
40
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
41 /* Macro, trading safety for speed */
5918
780b68df4560 Add cast to PyInt_AS_LONG macro, as suggested by Marc Lemburg.
Guido van Rossum <guido@python.org>
parents: 5861
diff changeset
42 #define PyInt_AS_LONG(op) (((PyIntObject *)(op))->ob_ival)
1329
519c25039c6a * Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents: 1257
diff changeset
43
9623
fa8f9fe0a33d Add prototypes for PyOS_strto[u]l -- Chris Herborth.
Guido van Rossum <guido@python.org>
parents: 9586
diff changeset
44 /* These aren't really part of the Int object, but they're handy; the protos
24752
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 22785
diff changeset
45 * are necessary for systems that need the magic of PyAPI_FUNC and that want
9623
fa8f9fe0a33d Add prototypes for PyOS_strto[u]l -- Chris Herborth.
Guido van Rossum <guido@python.org>
parents: 9586
diff changeset
46 * to have stropmodule as a dynamically loaded module instead of building it
fa8f9fe0a33d Add prototypes for PyOS_strto[u]l -- Chris Herborth.
Guido van Rossum <guido@python.org>
parents: 9586
diff changeset
47 * into the main Python shared library/DLL. Guido thinks I'm weird for
fa8f9fe0a33d Add prototypes for PyOS_strto[u]l -- Chris Herborth.
Guido van Rossum <guido@python.org>
parents: 9586
diff changeset
48 * building it this way. :-) [cjh]
fa8f9fe0a33d Add prototypes for PyOS_strto[u]l -- Chris Herborth.
Guido van Rossum <guido@python.org>
parents: 9586
diff changeset
49 */
24752
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 22785
diff changeset
50 PyAPI_FUNC(unsigned long) PyOS_strtoul(char *, char **, int);
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 22785
diff changeset
51 PyAPI_FUNC(long) PyOS_strtol(char *, char **, int);
9623
fa8f9fe0a33d Add prototypes for PyOS_strto[u]l -- Chris Herborth.
Guido van Rossum <guido@python.org>
parents: 9586
diff changeset
52
1329
519c25039c6a * Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents: 1257
diff changeset
53 #ifdef __cplusplus
519c25039c6a * Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents: 1257
diff changeset
54 }
519c25039c6a * Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents: 1257
diff changeset
55 #endif
519c25039c6a * Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents: 1257
diff changeset
56 #endif /* !Py_INTOBJECT_H */