[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[py-rrdtool-cvs] [Commit] py-rrdtool/src _rrdtoolmodule.c rrd_extra.h
From: |
Hye-Shik Chang <address@hidden> |
Subject: |
[py-rrdtool-cvs] [Commit] py-rrdtool/src _rrdtoolmodule.c rrd_extra.h |
Date: |
Sat, 25 May 2002 20:40:26 -0400 |
perky 02/05/25 20:40:26
Modified: src _rrdtoolmodule.c rrd_extra.h
Log:
Add _rrdtool.isnan function
Revision Changes Path
1.8 +24 -3 py-rrdtool/src/_rrdtoolmodule.c
Index: _rrdtoolmodule.c
===================================================================
RCS file: /cvsroot/py-rrdtool/py-rrdtool/src/_rrdtoolmodule.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- _rrdtoolmodule.c 26 May 2002 00:21:33 -0000 1.7
+++ _rrdtoolmodule.c 26 May 2002 00:40:26 -0000 1.8
@@ -4,10 +4,10 @@
* RRDTool Python binding
*
* Author : Hye-Shik Chang <address@hidden>
- * Date : $Date: 2002/05/26 00:21:33 $
+ * Date : $Date: 2002/05/26 00:40:26 $
* Created : 23 May 2002
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
*
==========================================================================
* This file is part of py-rrdtool.
@@ -29,7 +29,7 @@
*/
static char *version =
-"$Id: _rrdtoolmodule.c,v 1.7 2002/05/26 00:21:33 perky Exp $";
+"$Id: _rrdtoolmodule.c,v 1.8 2002/05/26 00:40:26 perky Exp $";
#include "Python.h"
#include "rrd.h"
@@ -441,6 +441,26 @@
return r;
}
+static char PyRRD_isnan__doc__[] =
+"isnan(value): test wheter value is NaN";
+
+static PyObject *
+PyRRD_isnan(PyObject *self, PyObject *args)
+{
+ double tv;
+
+ if (! PyArg_ParseTuple(args, "d:isnan", &tv))
+ return NULL;
+
+ if (isnan(tv)) {
+ Py_INCREF(Py_True);
+ return Py_True;
+ } else {
+ Py_INCREF(Py_False);
+ return Py_False;
+ }
+}
+
/* List of methods defined in the module */
#define meth(name, func, doc) {name, (PyCFunction)func, METH_VARARGS, doc}
@@ -453,6 +473,7 @@
meth("last", PyRRD_last, PyRRD_last__doc__),
meth("resize", PyRRD_resize, PyRRD_resize__doc__),
meth("info", PyRRD_info, PyRRD_info__doc__),
+ meth("isnan", PyRRD_isnan, PyRRD_isnan__doc__),
{NULL, NULL},
};
1.3 +9 -0 py-rrdtool/src/rrd_extra.h
Index: rrd_extra.h
===================================================================
RCS file: /cvsroot/py-rrdtool/py-rrdtool/src/rrd_extra.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- rrd_extra.h 24 May 2002 16:57:42 -0000 1.2
+++ rrd_extra.h 26 May 2002 00:40:26 -0000 1.3
@@ -36,6 +36,15 @@
#include "rrd_format.h"
+#ifndef WIN32
+#ifndef isnan /* POSIX */
+int isnan(double value);
+#endif
+#else /* Windows only */
+#include <float.h>
+#define isnan _isnan
+#endif
+
void rrd_free(rrd_t *rrd);
void rrd_init(rrd_t *rrd);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [py-rrdtool-cvs] [Commit] py-rrdtool/src _rrdtoolmodule.c rrd_extra.h,
Hye-Shik Chang <address@hidden> <=