Guido van Rossum | a330996 | 1993-07-28 09:05:47 +0000 | [diff] [blame] | 1 | #ifndef Py_LONGOBJECT_H |
| 2 | #define Py_LONGOBJECT_H |
| 3 | #ifdef __cplusplus |
| 4 | extern "C" { |
| 5 | #endif |
| 6 | |
Guido van Rossum | edcc38a | 1991-05-05 20:09:44 +0000 | [diff] [blame] | 7 | |
| 8 | /* Long (arbitrary precision) integer object interface */ |
| 9 | |
Guido van Rossum | caa6380 | 1995-01-12 11:45:45 +0000 | [diff] [blame] | 10 | typedef struct _longobject PyLongObject; /* Revealed in longintrepr.h */ |
Guido van Rossum | 44c8f69 | 1992-01-19 16:31:28 +0000 | [diff] [blame] | 11 | |
Guido van Rossum | 051ab12 | 1995-02-27 10:17:52 +0000 | [diff] [blame] | 12 | extern DL_IMPORT(PyTypeObject) PyLong_Type; |
Guido van Rossum | edcc38a | 1991-05-05 20:09:44 +0000 | [diff] [blame] | 13 | |
Guido van Rossum | caa6380 | 1995-01-12 11:45:45 +0000 | [diff] [blame] | 14 | #define PyLong_Check(op) ((op)->ob_type == &PyLong_Type) |
Guido van Rossum | edcc38a | 1991-05-05 20:09:44 +0000 | [diff] [blame] | 15 | |
Tim Peters | 9f688bf | 2000-07-07 15:53:28 +0000 | [diff] [blame] | 16 | extern DL_IMPORT(PyObject *) PyLong_FromLong(long); |
| 17 | extern DL_IMPORT(PyObject *) PyLong_FromUnsignedLong(unsigned long); |
| 18 | extern DL_IMPORT(PyObject *) PyLong_FromDouble(double); |
| 19 | extern DL_IMPORT(long) PyLong_AsLong(PyObject *); |
| 20 | extern DL_IMPORT(unsigned long) PyLong_AsUnsignedLong(PyObject *); |
| 21 | extern DL_IMPORT(double) PyLong_AsDouble(PyObject *); |
| 22 | extern DL_IMPORT(PyObject *) PyLong_FromVoidPtr(void *); |
| 23 | extern DL_IMPORT(void *) PyLong_AsVoidPtr(PyObject *); |
Guido van Rossum | 44c8f69 | 1992-01-19 16:31:28 +0000 | [diff] [blame] | 24 | |
Guido van Rossum | 1a8791e | 1998-08-04 22:46:29 +0000 | [diff] [blame] | 25 | #ifdef HAVE_LONG_LONG |
Guido van Rossum | 2e6e7d4 | 1999-01-06 18:39:42 +0000 | [diff] [blame] | 26 | |
| 27 | #ifdef HAVE_LIMITS_H |
| 28 | #include <limits.h> |
| 29 | #endif |
| 30 | |
| 31 | /* Hopefully this is portable... */ |
| 32 | #ifndef LONG_MAX |
| 33 | #define LONG_MAX 2147483647L |
| 34 | #endif |
| 35 | #ifndef ULONG_MAX |
| 36 | #define ULONG_MAX 4294967295U |
| 37 | #endif |
| 38 | #ifndef LONGLONG_MAX |
| 39 | #define LONGLONG_MAX 9223372036854775807LL |
| 40 | #endif |
| 41 | #ifndef ULONGLONG_MAX |
| 42 | #define ULONGLONG_MAX 0xffffffffffffffffULL |
| 43 | #endif |
Guido van Rossum | 2e6e7d4 | 1999-01-06 18:39:42 +0000 | [diff] [blame] | 44 | |
Tim Peters | 9f688bf | 2000-07-07 15:53:28 +0000 | [diff] [blame] | 45 | extern DL_IMPORT(PyObject *) PyLong_FromLongLong(LONG_LONG); |
| 46 | extern DL_IMPORT(PyObject *) PyLong_FromUnsignedLongLong(unsigned LONG_LONG); |
| 47 | extern DL_IMPORT(LONG_LONG) PyLong_AsLongLong(PyObject *); |
| 48 | extern DL_IMPORT(unsigned LONG_LONG) PyLong_AsUnsignedLongLong(PyObject *); |
Guido van Rossum | 3293b07 | 1998-08-25 16:07:15 +0000 | [diff] [blame] | 49 | #endif /* HAVE_LONG_LONG */ |
Guido van Rossum | 1a8791e | 1998-08-04 22:46:29 +0000 | [diff] [blame] | 50 | |
Tim Peters | 9f688bf | 2000-07-07 15:53:28 +0000 | [diff] [blame] | 51 | DL_IMPORT(PyObject *) PyLong_FromString(char *, char **, int); |
| 52 | DL_IMPORT(PyObject *) PyLong_FromUnicode(Py_UNICODE*, int, int); |
Guido van Rossum | a330996 | 1993-07-28 09:05:47 +0000 | [diff] [blame] | 53 | |
| 54 | #ifdef __cplusplus |
| 55 | } |
| 56 | #endif |
| 57 | #endif /* !Py_LONGOBJECT_H */ |