Guido van Rossum | f9fca92 | 1996-01-12 00:47:05 +0000 | [diff] [blame] | 1 | #ifndef COMPLEXOBJECT_H |
| 2 | #define COMPLEXOBJECT_H |
| 3 | #ifdef __cplusplus |
| 4 | extern "C" { |
| 5 | #endif |
| 6 | |
| 7 | /* Complex number structure */ |
| 8 | |
| 9 | typedef struct { |
| 10 | double real; |
| 11 | double imag; |
| 12 | } complex; |
| 13 | |
| 14 | /* Operations on complex numbers from complexmodule.c */ |
| 15 | |
| 16 | extern complex c_sum(); |
| 17 | extern complex c_diff(); |
| 18 | extern complex c_neg(); |
| 19 | extern complex c_prod(); |
| 20 | extern complex c_quot(); |
| 21 | extern complex c_pow(); |
| 22 | |
| 23 | |
| 24 | /* Complex object interface */ |
| 25 | |
| 26 | /* |
| 27 | PyComplexObject represents a complex number with double-precision |
| 28 | real and imaginary parts. |
| 29 | */ |
| 30 | |
| 31 | typedef struct { |
| 32 | PyObject_HEAD |
| 33 | complex cval; |
| 34 | } PyComplexObject; |
| 35 | |
| 36 | extern DL_IMPORT(PyTypeObject) PyComplex_Type; |
| 37 | |
| 38 | #define PyComplex_Check(op) ((op)->ob_type == &PyComplex_Type) |
| 39 | |
| 40 | extern PyObject *PyComplex_FromCComplex Py_PROTO((complex)); |
| 41 | extern PyObject *PyComplex_FromDoubles Py_PROTO((double real, double imag)); |
| 42 | |
| 43 | extern double PyComplex_RealAsDouble Py_PROTO((PyObject *op)); |
| 44 | extern double PyComplex_ImagAsDouble Py_PROTO((PyObject *op)); |
Guido van Rossum | 5990592 | 1996-01-12 00:55:11 +0000 | [diff] [blame] | 45 | extern complex PyComplex_AsCComplex Py_PROTO((PyObject *op)); |
Guido van Rossum | f9fca92 | 1996-01-12 00:47:05 +0000 | [diff] [blame] | 46 | |
| 47 | #ifdef __cplusplus |
| 48 | } |
| 49 | #endif |
| 50 | #endif /* !COMPLEXOBJECT_H */ |