[Python-checkins] CVS: python/dist/src/Objects complexobject.c,2.27,2.28

Fred L. Drake python-dev@python.org
Sat, 8 Jul 2000 21:36:07 -0700


Update of /cvsroot/python/python/dist/src/Objects
In directory slayer.i.sourceforge.net:/tmp/cvs-serv20533
Modified Files:
	complexobject.c 
Log Message:
ANSI-fication of the sources.
Index: complexobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/complexobject.c,v
retrieving revision 2.27
retrieving revision 2.28
diff -C2 -r2.27 -r2.28
*** complexobject.c	2000年06月30日 23:58:05	2.27
--- complexobject.c	2000年07月09日 04:36:04	2.28
***************
*** 29,34 ****
 static Py_complex c_1 = {1., 0.};
 
! Py_complex c_sum(a,b)
! 	Py_complex a,b;
 {
 	Py_complex r;
--- 29,33 ----
 static Py_complex c_1 = {1., 0.};
 
! Py_complex c_sum(Py_complex a, Py_complex b)
 {
 	Py_complex r;
***************
*** 38,43 ****
 }
 
! Py_complex c_diff(a,b)
! 	Py_complex a,b;
 {
 	Py_complex r;
--- 37,41 ----
 }
 
! Py_complex c_diff(Py_complex a, Py_complex b)
 {
 	Py_complex r;
***************
*** 47,52 ****
 }
 
! Py_complex c_neg(a)
! 	Py_complex a;
 {
 	Py_complex r;
--- 45,49 ----
 }
 
! Py_complex c_neg(Py_complex a)
 {
 	Py_complex r;
***************
*** 56,61 ****
 }
 
! Py_complex c_prod(a,b)
! 	Py_complex a,b;
 {
 	Py_complex r;
--- 53,57 ----
 }
 
! Py_complex c_prod(Py_complex a, Py_complex b)
 {
 	Py_complex r;
***************
*** 65,70 ****
 }
 
! Py_complex c_quot(a,b)
! 	Py_complex a,b;
 {
 	Py_complex r;
--- 61,65 ----
 }
 
! Py_complex c_quot(Py_complex a, Py_complex b)
 {
 	Py_complex r;
***************
*** 77,82 ****
 }
 
! Py_complex c_pow(a,b)
! 	Py_complex a,b;
 {
 	Py_complex r;
--- 72,76 ----
 }
 
! Py_complex c_pow(Py_complex a, Py_complex b)
 {
 	Py_complex r;
***************
*** 107,113 ****
 }
 
! static Py_complex c_powu(x, n)
! 	Py_complex x;
! 	long n;
 {
 	Py_complex r, p;
--- 101,105 ----
 }
 
! static Py_complex c_powu(Py_complex x, long n)
 {
 	Py_complex r, p;
***************
*** 124,130 ****
 }
 
! static Py_complex c_powi(x, n)
! 	Py_complex x;
! 	long n;
 {
 	Py_complex cn;
--- 116,120 ----
 }
 
! static Py_complex c_powi(Py_complex x, long n)
 {
 	Py_complex cn;
***************
*** 143,148 ****
 
 PyObject *
! PyComplex_FromCComplex(cval)
! 	Py_complex cval;
 {
 	register PyComplexObject *op;
--- 133,137 ----
 
 PyObject *
! PyComplex_FromCComplex(Py_complex cval)
 {
 	register PyComplexObject *op;
***************
*** 158,163 ****
 
 PyObject *
! PyComplex_FromDoubles(real, imag)
! 	double real, imag;
 {
 	Py_complex c;
--- 147,151 ----
 
 PyObject *
! PyComplex_FromDoubles(double real, double imag)
 {
 	Py_complex c;
***************
*** 168,177 ****
 
 double
! PyComplex_RealAsDouble(op)
! 	PyObject *op;
 {
 	if (PyComplex_Check(op)) {
 		return ((PyComplexObject *)op)->cval.real;
! 	} else {
 		return PyFloat_AsDouble(op);
 	}
--- 156,165 ----
 
 double
! PyComplex_RealAsDouble(PyObject *op)
 {
 	if (PyComplex_Check(op)) {
 		return ((PyComplexObject *)op)->cval.real;
! 	}
! 	else {
 		return PyFloat_AsDouble(op);
 	}
***************
*** 179,188 ****
 
 double
! PyComplex_ImagAsDouble(op)
! 	PyObject *op;
 {
 	if (PyComplex_Check(op)) {
 		return ((PyComplexObject *)op)->cval.imag;
! 	} else {
 		return 0.0;
 	}
--- 167,176 ----
 
 double
! PyComplex_ImagAsDouble(PyObject *op)
 {
 	if (PyComplex_Check(op)) {
 		return ((PyComplexObject *)op)->cval.imag;
! 	}
! 	else {
 		return 0.0;
 	}
***************
*** 190,200 ****
 
 Py_complex
! PyComplex_AsCComplex(op)
! 	PyObject *op;
 {
 	Py_complex cv;
 	if (PyComplex_Check(op)) {
 		return ((PyComplexObject *)op)->cval;
! 	} else {
 		cv.real = PyFloat_AsDouble(op);
 		cv.imag = 0.;
--- 178,188 ----
 
 Py_complex
! PyComplex_AsCComplex(PyObject *op)
 {
 	Py_complex cv;
 	if (PyComplex_Check(op)) {
 		return ((PyComplexObject *)op)->cval;
! 	}
! 	else {
 		cv.real = PyFloat_AsDouble(op);
 		cv.imag = 0.;
***************
*** 204,209 ****
 
 static void
! complex_dealloc(op)
! 	PyObject *op;
 {
 	PyObject_DEL(op);
--- 192,196 ----
 
 static void
! complex_dealloc(PyObject *op)
 {
 	PyObject_DEL(op);
***************
*** 212,218 ****
 
 static void
! complex_buf_repr(buf, v)
! 	char *buf;
! 	PyComplexObject *v;
 {
 	if (v->cval.real == 0.)
--- 199,203 ----
 
 static void
! complex_buf_repr(char *buf, PyComplexObject *v)
 {
 	if (v->cval.real == 0.)
***************
*** 223,230 ****
 
 static int
! complex_print(v, fp, flags)
! 	PyComplexObject *v;
! 	FILE *fp;
! 	int flags; /* Not used but required by interface */
 {
 	char buf[100];
--- 208,213 ----
 
 static int
! complex_print(PyComplexObject *v, FILE *fp, int flags)
! /* flags -- not used but required by interface */
 {
 	char buf[100];
***************
*** 235,240 ****
 
 static PyObject *
! complex_repr(v)
! 	PyComplexObject *v;
 {
 	char buf[100];
--- 218,222 ----
 
 static PyObject *
! complex_repr(PyComplexObject *v)
 {
 	char buf[100];
***************
*** 244,266 ****
 
 static int
! complex_compare(v, w)
! 	PyComplexObject *v, *w;
 {
! /* Note: "greater" and "smaller" have no meaning for complex numbers,
! but Python requires that they be defined nevertheless. */
 	Py_complex i, j;
 	i = v->cval;
 	j = w->cval;
 	if (i.real == j.real && i.imag == j.imag)
! 	 return 0;
 	else if (i.real != j.real)
! 	 return (i.real < j.real) ? -1 : 1;
 	else
! 	 return (i.imag < j.imag) ? -1 : 1;
 }
 
 static long
! complex_hash(v)
! 	PyComplexObject *v;
 {
 	double intpart, fractpart;
--- 226,246 ----
 
 static int
! complex_compare(PyComplexObject *v, PyComplexObject *w)
 {
! 	/* Note: "greater" and "smaller" have no meaning for complex numbers,
! 	 but Python requires that they be defined nevertheless. */
 	Py_complex i, j;
 	i = v->cval;
 	j = w->cval;
 	if (i.real == j.real && i.imag == j.imag)
! 		return 0;
 	else if (i.real != j.real)
! 		return (i.real < j.real) ? -1 : 1;
 	else
! 		return (i.imag < j.imag) ? -1 : 1;
 }
 
 static long
! complex_hash(PyComplexObject *v)
 {
 	double intpart, fractpart;
***************
*** 313,319 ****
 
 static PyObject *
! complex_add(v, w)
! 	PyComplexObject *v;
! 	PyComplexObject *w;
 {
 	Py_complex result;
--- 293,297 ----
 
 static PyObject *
! complex_add(PyComplexObject *v, PyComplexObject *w)
 {
 	Py_complex result;
***************
*** 325,331 ****
 
 static PyObject *
! complex_sub(v, w)
! 	PyComplexObject *v;
! 	PyComplexObject *w;
 {
 	Py_complex result;
--- 303,307 ----
 
 static PyObject *
! complex_sub(PyComplexObject *v, PyComplexObject *w)
 {
 	Py_complex result;
***************
*** 337,343 ****
 
 static PyObject *
! complex_mul(v, w)
! 	PyComplexObject *v;
! 	PyComplexObject *w;
 {
 	Py_complex result;
--- 313,317 ----
 
 static PyObject *
! complex_mul(PyComplexObject *v, PyComplexObject *w)
 {
 	Py_complex result;
***************
*** 349,355 ****
 
 static PyObject *
! complex_div(v, w)
! 	PyComplexObject *v;
! 	PyComplexObject *w;
 {
 	Py_complex quot;
--- 323,327 ----
 
 static PyObject *
! complex_div(PyComplexObject *v, PyComplexObject *w)
 {
 	Py_complex quot;
***************
*** 366,372 ****
 
 static PyObject *
! complex_remainder(v, w)
! 	PyComplexObject *v;
! 	PyComplexObject *w;
 {
 Py_complex div, mod;
--- 338,342 ----
 
 static PyObject *
! complex_remainder(PyComplexObject *v, PyComplexObject *w)
 {
 Py_complex div, mod;
***************
*** 386,392 ****
 
 static PyObject *
! complex_divmod(v, w)
! 	PyComplexObject *v;
! 	PyComplexObject *w;
 {
 Py_complex div, mod;
--- 356,360 ----
 
 static PyObject *
! complex_divmod(PyComplexObject *v, PyComplexObject *w)
 {
 Py_complex div, mod;
***************
*** 410,417 ****
 
 static PyObject *
! complex_pow(v, w, z)
! 	PyComplexObject *v;
! 	PyObject *w;
! 	PyComplexObject *z;
 {
 	Py_complex p;
--- 378,382 ----
 
 static PyObject *
! complex_pow(PyComplexObject *v, PyObject *w, PyComplexObject *z)
 {
 	Py_complex p;
***************
*** 423,427 ****
 		return NULL;
 	}
- 
 	PyFPE_START_PROTECT("complex_pow", return 0)
 	errno = 0;
--- 388,391 ----
***************
*** 439,449 ****
 		return NULL;
 	}
- 
 	return PyComplex_FromCComplex(p);
 }
 
 static PyObject *
! complex_neg(v)
! 	PyComplexObject *v;
 {
 	Py_complex neg;
--- 403,411 ----
 		return NULL;
 	}
 	return PyComplex_FromCComplex(p);
 }
 
 static PyObject *
! complex_neg(PyComplexObject *v)
 {
 	Py_complex neg;
***************
*** 454,459 ****
 
 static PyObject *
! complex_pos(v)
! 	PyComplexObject *v;
 {
 	Py_INCREF(v);
--- 416,420 ----
 
 static PyObject *
! complex_pos(PyComplexObject *v)
 {
 	Py_INCREF(v);
***************
*** 462,467 ****
 
 static PyObject *
! complex_abs(v)
! 	PyComplexObject *v;
 {
 	double result;
--- 423,427 ----
 
 static PyObject *
! complex_abs(PyComplexObject *v)
 {
 	double result;
***************
*** 473,478 ****
 
 static int
! complex_nonzero(v)
! 	PyComplexObject *v;
 {
 	return v->cval.real != 0.0 || v->cval.imag != 0.0;
--- 433,437 ----
 
 static int
! complex_nonzero(PyComplexObject *v)
 {
 	return v->cval.real != 0.0 || v->cval.imag != 0.0;
***************
*** 480,486 ****
 
 static int
! complex_coerce(pv, pw)
! 	PyObject **pv;
! 	PyObject **pw;
 {
 	Py_complex cval;
--- 439,443 ----
 
 static int
! complex_coerce(PyObject **pv, PyObject **pw)
 {
 	Py_complex cval;
***************
*** 508,513 ****
 
 static PyObject *
! complex_int(v)
! 	PyObject *v;
 {
 	PyErr_SetString(PyExc_TypeError,
--- 465,469 ----
 
 static PyObject *
! complex_int(PyObject *v)
 {
 	PyErr_SetString(PyExc_TypeError,
***************
*** 517,522 ****
 
 static PyObject *
! complex_long(v)
! 	PyObject *v;
 {
 	PyErr_SetString(PyExc_TypeError,
--- 473,477 ----
 
 static PyObject *
! complex_long(PyObject *v)
 {
 	PyErr_SetString(PyExc_TypeError,
***************
*** 526,531 ****
 
 static PyObject *
! complex_float(v)
! 	PyObject *v;
 {
 	PyErr_SetString(PyExc_TypeError,
--- 481,485 ----
 
 static PyObject *
! complex_float(PyObject *v)
 {
 	PyErr_SetString(PyExc_TypeError,
***************
*** 535,541 ****
 
 static PyObject *
! complex_conjugate(self, args)
! 	PyObject *self;
! 	PyObject *args;
 {
 	Py_complex c;
--- 489,493 ----
 
 static PyObject *
! complex_conjugate(PyObject *self, PyObject *args)
 {
 	Py_complex c;
***************
*** 554,560 ****
 
 static PyObject *
! complex_getattr(self, name)
! 	PyComplexObject *self;
! 	char *name;
 {
 	if (strcmp(name, "real") == 0)
--- 506,510 ----
 
 static PyObject *
! complex_getattr(PyComplexObject *self, char *name)
 {
 	if (strcmp(name, "real") == 0)

AltStyle によって変換されたページ (->オリジナル) /