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 | /*********************************************************** |
Guido van Rossum | fd71b9e | 2000-06-30 23:50:40 +0000 | [diff] [blame] | 8 | Copyright (c) 2000, BeOpen.com. |
| 9 | Copyright (c) 1995-2000, Corporation for National Research Initiatives. |
| 10 | Copyright (c) 1990-1995, Stichting Mathematisch Centrum. |
| 11 | All rights reserved. |
Guido van Rossum | edcc38a | 1991-05-05 20:09:44 +0000 | [diff] [blame] | 12 | |
Guido van Rossum | fd71b9e | 2000-06-30 23:50:40 +0000 | [diff] [blame] | 13 | See the file "Misc/COPYRIGHT" for information on usage and |
| 14 | redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
Guido van Rossum | edcc38a | 1991-05-05 20:09:44 +0000 | [diff] [blame] | 15 | ******************************************************************/ |
| 16 | |
| 17 | /* Long (arbitrary precision) integer object interface */ |
| 18 | |
Guido van Rossum | caa6380 | 1995-01-12 11:45:45 +0000 | [diff] [blame] | 19 | typedef struct _longobject PyLongObject; /* Revealed in longintrepr.h */ |
Guido van Rossum | 44c8f69 | 1992-01-19 16:31:28 +0000 | [diff] [blame] | 20 | |
Guido van Rossum | 051ab12 | 1995-02-27 10:17:52 +0000 | [diff] [blame] | 21 | extern DL_IMPORT(PyTypeObject) PyLong_Type; |
Guido van Rossum | edcc38a | 1991-05-05 20:09:44 +0000 | [diff] [blame] | 22 | |
Guido van Rossum | caa6380 | 1995-01-12 11:45:45 +0000 | [diff] [blame] | 23 | #define PyLong_Check(op) ((op)->ob_type == &PyLong_Type) |
Guido van Rossum | edcc38a | 1991-05-05 20:09:44 +0000 | [diff] [blame] | 24 | |
Tim Peters | 9f688bf | 2000-07-07 15:53:28 +0000 | [diff] [blame^] | 25 | extern DL_IMPORT(PyObject *) PyLong_FromLong(long); |
| 26 | extern DL_IMPORT(PyObject *) PyLong_FromUnsignedLong(unsigned long); |
| 27 | extern DL_IMPORT(PyObject *) PyLong_FromDouble(double); |
| 28 | extern DL_IMPORT(long) PyLong_AsLong(PyObject *); |
| 29 | extern DL_IMPORT(unsigned long) PyLong_AsUnsignedLong(PyObject *); |
| 30 | extern DL_IMPORT(double) PyLong_AsDouble(PyObject *); |
| 31 | extern DL_IMPORT(PyObject *) PyLong_FromVoidPtr(void *); |
| 32 | extern DL_IMPORT(void *) PyLong_AsVoidPtr(PyObject *); |
Guido van Rossum | 44c8f69 | 1992-01-19 16:31:28 +0000 | [diff] [blame] | 33 | |
Guido van Rossum | 1a8791e | 1998-08-04 22:46:29 +0000 | [diff] [blame] | 34 | #ifdef HAVE_LONG_LONG |
Guido van Rossum | 2e6e7d4 | 1999-01-06 18:39:42 +0000 | [diff] [blame] | 35 | |
| 36 | #ifdef HAVE_LIMITS_H |
| 37 | #include <limits.h> |
| 38 | #endif |
| 39 | |
| 40 | /* Hopefully this is portable... */ |
| 41 | #ifndef LONG_MAX |
| 42 | #define LONG_MAX 2147483647L |
| 43 | #endif |
| 44 | #ifndef ULONG_MAX |
| 45 | #define ULONG_MAX 4294967295U |
| 46 | #endif |
| 47 | #ifndef LONGLONG_MAX |
| 48 | #define LONGLONG_MAX 9223372036854775807LL |
| 49 | #endif |
| 50 | #ifndef ULONGLONG_MAX |
| 51 | #define ULONGLONG_MAX 0xffffffffffffffffULL |
| 52 | #endif |
Guido van Rossum | 3293b07 | 1998-08-25 16:07:15 +0000 | [diff] [blame] | 53 | #ifndef LONG_LONG |
| 54 | #define LONG_LONG long long |
Guido van Rossum | 1a8791e | 1998-08-04 22:46:29 +0000 | [diff] [blame] | 55 | #endif |
Guido van Rossum | 2e6e7d4 | 1999-01-06 18:39:42 +0000 | [diff] [blame] | 56 | |
Tim Peters | 9f688bf | 2000-07-07 15:53:28 +0000 | [diff] [blame^] | 57 | extern DL_IMPORT(PyObject *) PyLong_FromLongLong(LONG_LONG); |
| 58 | extern DL_IMPORT(PyObject *) PyLong_FromUnsignedLongLong(unsigned LONG_LONG); |
| 59 | extern DL_IMPORT(LONG_LONG) PyLong_AsLongLong(PyObject *); |
| 60 | extern DL_IMPORT(unsigned LONG_LONG) PyLong_AsUnsignedLongLong(PyObject *); |
Guido van Rossum | 3293b07 | 1998-08-25 16:07:15 +0000 | [diff] [blame] | 61 | #endif /* HAVE_LONG_LONG */ |
Guido van Rossum | 1a8791e | 1998-08-04 22:46:29 +0000 | [diff] [blame] | 62 | |
Tim Peters | 9f688bf | 2000-07-07 15:53:28 +0000 | [diff] [blame^] | 63 | DL_IMPORT(PyObject *) PyLong_FromString(char *, char **, int); |
| 64 | DL_IMPORT(PyObject *) PyLong_FromUnicode(Py_UNICODE*, int, int); |
Guido van Rossum | a330996 | 1993-07-28 09:05:47 +0000 | [diff] [blame] | 65 | |
| 66 | #ifdef __cplusplus |
| 67 | } |
| 68 | #endif |
| 69 | #endif /* !Py_LONGOBJECT_H */ |