History

add hg and python

cinap_lenrek committed 15 years ago

Commit 4bb9e221 parent 987265c3706 files · +1228772 −-233Browse files

Showing the changes to sys/src/cmd/python/Include/complexobject.h (1 of 3706 files). Show all

Unified · Split

sys/src/cmd/python/Include/complexobject.h+58−0
@@ -0,0 +1,58 @@
1+/* Complex number structure */
2+
3+#ifndef Py_COMPLEXOBJECT_H
4+#define Py_COMPLEXOBJECT_H
5+#ifdef __cplusplus
6+extern "C" {
7+#endif
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+PyAPI_FUNC(Py_complex) c_sum(Py_complex, Py_complex);
24+PyAPI_FUNC(Py_complex) c_diff(Py_complex, Py_complex);
25+PyAPI_FUNC(Py_complex) c_neg(Py_complex);
26+PyAPI_FUNC(Py_complex) c_prod(Py_complex, Py_complex);
27+PyAPI_FUNC(Py_complex) c_quot(Py_complex, Py_complex);
28+PyAPI_FUNC(Py_complex) c_pow(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+PyAPI_DATA(PyTypeObject) PyComplex_Type;
44+
45+#define PyComplex_Check(op) PyObject_TypeCheck(op, &PyComplex_Type)
46+#define PyComplex_CheckExact(op) ((op)->ob_type == &PyComplex_Type)
47+
48+PyAPI_FUNC(PyObject *) PyComplex_FromCComplex(Py_complex);
49+PyAPI_FUNC(PyObject *) PyComplex_FromDoubles(double real, double imag);
50+
51+PyAPI_FUNC(double) PyComplex_RealAsDouble(PyObject *op);
52+PyAPI_FUNC(double) PyComplex_ImagAsDouble(PyObject *op);
53+PyAPI_FUNC(Py_complex) PyComplex_AsCComplex(PyObject *op);
54+
55+#ifdef __cplusplus
56+}
57+#endif
58+#endif /* !Py_COMPLEXOBJECT_H */