jpayne@69: /* Complex number structure */ jpayne@69: jpayne@69: #ifndef Py_COMPLEXOBJECT_H jpayne@69: #define Py_COMPLEXOBJECT_H jpayne@69: #ifdef __cplusplus jpayne@69: extern "C" { jpayne@69: #endif jpayne@69: jpayne@69: #ifndef Py_LIMITED_API jpayne@69: typedef struct { jpayne@69: double real; jpayne@69: double imag; jpayne@69: } Py_complex; jpayne@69: jpayne@69: /* Operations on complex numbers from complexmodule.c */ jpayne@69: jpayne@69: PyAPI_FUNC(Py_complex) _Py_c_sum(Py_complex, Py_complex); jpayne@69: PyAPI_FUNC(Py_complex) _Py_c_diff(Py_complex, Py_complex); jpayne@69: PyAPI_FUNC(Py_complex) _Py_c_neg(Py_complex); jpayne@69: PyAPI_FUNC(Py_complex) _Py_c_prod(Py_complex, Py_complex); jpayne@69: PyAPI_FUNC(Py_complex) _Py_c_quot(Py_complex, Py_complex); jpayne@69: PyAPI_FUNC(Py_complex) _Py_c_pow(Py_complex, Py_complex); jpayne@69: PyAPI_FUNC(double) _Py_c_abs(Py_complex); jpayne@69: #endif jpayne@69: jpayne@69: /* Complex object interface */ jpayne@69: jpayne@69: /* jpayne@69: PyComplexObject represents a complex number with double-precision jpayne@69: real and imaginary parts. jpayne@69: */ jpayne@69: #ifndef Py_LIMITED_API jpayne@69: typedef struct { jpayne@69: PyObject_HEAD jpayne@69: Py_complex cval; jpayne@69: } PyComplexObject; jpayne@69: #endif jpayne@69: jpayne@69: PyAPI_DATA(PyTypeObject) PyComplex_Type; jpayne@69: jpayne@69: #define PyComplex_Check(op) PyObject_TypeCheck(op, &PyComplex_Type) jpayne@69: #define PyComplex_CheckExact(op) (Py_TYPE(op) == &PyComplex_Type) jpayne@69: jpayne@69: #ifndef Py_LIMITED_API jpayne@69: PyAPI_FUNC(PyObject *) PyComplex_FromCComplex(Py_complex); jpayne@69: #endif jpayne@69: PyAPI_FUNC(PyObject *) PyComplex_FromDoubles(double real, double imag); jpayne@69: jpayne@69: PyAPI_FUNC(double) PyComplex_RealAsDouble(PyObject *op); jpayne@69: PyAPI_FUNC(double) PyComplex_ImagAsDouble(PyObject *op); jpayne@69: #ifndef Py_LIMITED_API jpayne@69: PyAPI_FUNC(Py_complex) PyComplex_AsCComplex(PyObject *op); jpayne@69: #endif jpayne@69: jpayne@69: /* Format the object based on the format_spec, as defined in PEP 3101 jpayne@69: (Advanced String Formatting). */ jpayne@69: #ifndef Py_LIMITED_API jpayne@69: PyAPI_FUNC(int) _PyComplex_FormatAdvancedWriter( jpayne@69: _PyUnicodeWriter *writer, jpayne@69: PyObject *obj, jpayne@69: PyObject *format_spec, jpayne@69: Py_ssize_t start, jpayne@69: Py_ssize_t end); jpayne@69: #endif jpayne@69: jpayne@69: #ifdef __cplusplus jpayne@69: } jpayne@69: #endif jpayne@69: #endif /* !Py_COMPLEXOBJECT_H */