Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | #ifndef Py_INTOBJECT_H |
2 | #define Py_INTOBJECT_H | |
3 | #ifdef __cplusplus | |
4 | extern "C" { | |
5 | #endif | |
6 | ||
7 | typedef struct { | |
8 | PyObject_HEAD | |
9 | long ob_ival; | |
10 | } PyIntObject; | |
11 | ||
12 | PyAPI_DATA(PyTypeObject) PyInt_Type; | |
13 | ||
14 | #define PyInt_Check(op) PyObject_TypeCheck(op, &PyInt_Type) | |
15 | #define PyInt_CheckExact(op) ((op)->ob_type == &PyInt_Type) | |
16 | ||
17 | PyAPI_FUNC(PyObject *) PyInt_FromString(char*, char**, int); | |
18 | #ifdef Py_USING_UNICODE | |
19 | PyAPI_FUNC(PyObject *) PyInt_FromUnicode(Py_UNICODE*, int, int); | |
20 | #endif | |
21 | PyAPI_FUNC(PyObject *) PyInt_FromLong(long); | |
22 | PyAPI_FUNC(long) PyInt_AsLong(PyObject *); | |
23 | PyAPI_FUNC(unsigned long) PyInt_AsUnsignedLongMask(PyObject *); | |
24 | #ifdef HAVE_LONG_LONG | |
25 | PyAPI_FUNC(unsigned PY_LONG_LONG) PyInt_AsUnsignedLongLongMask(PyObject *); | |
26 | #endif | |
27 | ||
28 | PyAPI_FUNC(long) PyInt_GetMax(void); | |
29 | ||
30 | /* Macro, trading safety for speed */ | |
31 | #define PyInt_AS_LONG(op) (((PyIntObject *)(op))->ob_ival) | |
32 | ||
33 | /* These aren't really part of the Int object, but they're handy; the protos | |
34 | * are necessary for systems that need the magic of PyAPI_FUNC and that want | |
35 | * to have stropmodule as a dynamically loaded module instead of building it | |
36 | * into the main Python shared library/DLL. Guido thinks I'm weird for | |
37 | * building it this way. :-) [cjh] | |
38 | */ | |
39 | PyAPI_FUNC(unsigned long) PyOS_strtoul(char *, char **, int); | |
40 | PyAPI_FUNC(long) PyOS_strtol(char *, char **, int); | |
41 | ||
42 | #ifdef __cplusplus | |
43 | } | |
44 | #endif | |
45 | #endif /* !Py_INTOBJECT_H */ |