home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / py2s152.zip / Include / complexobject.h < prev    next >
C/C++ Source or Header  |  1999-06-27  |  2KB  |  58 lines

  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. } Py_complex;
  13.  
  14. /* Operations on complex numbers from complexmodule.c */
  15.  
  16. #define c_sum _Py_c_sum
  17. #define c_diff _Py_c_diff
  18. #define c_neg _Py_c_neg
  19. #define c_prod _Py_c_prod
  20. #define c_quot _Py_c_quot
  21. #define c_pow _Py_c_pow
  22.  
  23. extern DL_IMPORT(Py_complex) c_sum Py_PROTO((Py_complex, Py_complex));
  24. extern DL_IMPORT(Py_complex) c_diff Py_PROTO((Py_complex, Py_complex));
  25. extern DL_IMPORT(Py_complex) c_neg Py_PROTO((Py_complex));
  26. extern DL_IMPORT(Py_complex) c_prod Py_PROTO((Py_complex, Py_complex));
  27. extern DL_IMPORT(Py_complex) c_quot Py_PROTO((Py_complex, Py_complex));
  28. extern DL_IMPORT(Py_complex) c_pow Py_PROTO((Py_complex, Py_complex));
  29.  
  30.  
  31. /* Complex object interface */
  32.  
  33. /*
  34. PyComplexObject represents a complex number with double-precision
  35. real and imaginary parts.
  36. */
  37.  
  38. typedef struct {
  39.     PyObject_HEAD
  40.     Py_complex cval;
  41. } PyComplexObject;     
  42.  
  43. extern DL_IMPORT(PyTypeObject) PyComplex_Type;
  44.  
  45. #define PyComplex_Check(op) ((op)->ob_type == &PyComplex_Type)
  46.  
  47. extern DL_IMPORT(PyObject *) PyComplex_FromCComplex Py_PROTO((Py_complex));
  48. extern DL_IMPORT(PyObject *) PyComplex_FromDoubles Py_PROTO((double real, double imag));
  49.  
  50. extern DL_IMPORT(double) PyComplex_RealAsDouble Py_PROTO((PyObject *op));
  51. extern DL_IMPORT(double) PyComplex_ImagAsDouble Py_PROTO((PyObject *op));
  52. extern DL_IMPORT(Py_complex) PyComplex_AsCComplex Py_PROTO((PyObject *op));
  53.  
  54. #ifdef __cplusplus
  55. }
  56. #endif
  57. #endif /* !COMPLEXOBJECT_H */
  58.