X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=binaries%2Fsrc%2Fglobplot%2Fbiopython-1.50%2FBio%2Fcsupport.c;fp=binaries%2Fsrc%2Fglobplot%2Fbiopython-1.50%2FBio%2Fcsupport.c;h=981ba636dc1b976412c2d393101dcbd17e839c74;hb=119df1cedad3d4760e6fd458713da2488eff79cc;hp=0000000000000000000000000000000000000000;hpb=d3806a66f002b93f6dc03447b6628f943a3ba90c;p=jabaws.git diff --git a/binaries/src/globplot/biopython-1.50/Bio/csupport.c b/binaries/src/globplot/biopython-1.50/Bio/csupport.c new file mode 100644 index 0000000..981ba63 --- /dev/null +++ b/binaries/src/globplot/biopython-1.50/Bio/csupport.c @@ -0,0 +1,30 @@ +/* Copyright 2002 by Jeffrey Chang. All rights reserved. + * This code is part of the Biopython distribution and governed by its + * license. Please see the LICENSE file that should have been included + * as part of this package. + * + * csupport.c + * Created 27 January 2002 + * + * Miscellaneous useful C functions not to be exported as a python + * module. + * + */ + +#include "Python.h" + + +/* Return a PyNumber as a double. + * Raises a TypeError if I can't do it. + */ +double PyNumber_AsDouble(PyObject *py_num) +{ + double val; + PyObject *floatobj; + + if((floatobj = PyNumber_Float(py_num)) == NULL) + return(0.0); + val = PyFloat_AsDouble(floatobj); + Py_DECREF(floatobj); + return val; +}