minor
This commit is contained in:
@ -101,8 +101,6 @@ static long add_record(dbCommon *prec)
|
|||||||
PyGILState_STATE pystate;
|
PyGILState_STATE pystate;
|
||||||
long ret;
|
long ret;
|
||||||
|
|
||||||
fprintf(stderr, "%s: init_record\n", prec->name);
|
|
||||||
|
|
||||||
if(!priv) {
|
if(!priv) {
|
||||||
DBENTRY ent;
|
DBENTRY ent;
|
||||||
|
|
||||||
@ -169,6 +167,7 @@ static long add_record(dbCommon *prec)
|
|||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
assert(priv->support);
|
assert(priv->support);
|
||||||
|
assert(priv->pyrecord);
|
||||||
ret = 0;
|
ret = 0;
|
||||||
done:
|
done:
|
||||||
PyGILState_Release(pystate);
|
PyGILState_Release(pystate);
|
||||||
@ -180,8 +179,6 @@ static long del_record(dbCommon *prec)
|
|||||||
pyDevice *priv=prec->dpvt;
|
pyDevice *priv=prec->dpvt;
|
||||||
PyGILState_STATE pystate;
|
PyGILState_STATE pystate;
|
||||||
|
|
||||||
fprintf(stderr, "%s: del_record. priv=%p\n", prec->name, priv);
|
|
||||||
|
|
||||||
if(!priv)
|
if(!priv)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -194,6 +191,7 @@ static long del_record(dbCommon *prec)
|
|||||||
}
|
}
|
||||||
|
|
||||||
assert(!priv->support);
|
assert(!priv->support);
|
||||||
|
assert(!priv->pyrecord);
|
||||||
|
|
||||||
PyGILState_Release(pystate);
|
PyGILState_Release(pystate);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -172,26 +172,28 @@ static PyObject* pyField_putval(pyField *self, PyObject* args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *pyField_getarray(pyField *self)
|
static PyObject *pyField_getarray(pyField *self)
|
||||||
#ifdef HAVE_NUMPY
|
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_NUMPY
|
||||||
int flags = NPY_CARRAY;
|
int flags = NPY_CARRAY;
|
||||||
char *data=self->addr.pfield;
|
char *data=self->addr.pfield;
|
||||||
npy_int dims[1] = {self->addr.no_elements};
|
npy_int dims[1] = {self->addr.no_elements};
|
||||||
PyArray_Descr *desc;
|
PyArray_Descr *desc;
|
||||||
|
|
||||||
if(self->addr.field_type>DBF_ENUM) {
|
if(self->addr.field_type>DBF_ENUM) {
|
||||||
PyErr_SetString(PyExc_TypeError, "Can not map field type to numpy type");
|
PyErr_SetString(PyExc_TypeError, "Can not map field type to numpy type");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
} else if(self->addr.field_type==DBF_STRING)
|
||||||
|
dims[0] *= self->addr.field_size;
|
||||||
|
|
||||||
desc = dbf2np[self->addr.field_type];
|
desc = dbf2np[self->addr.field_type];
|
||||||
Py_XINCREF(desc);
|
Py_XINCREF(desc);
|
||||||
return PyArray_NewFromDescr(&PyArray_Type, desc, 1, dims, NULL, data, flags, (PyObject*)self);
|
return PyArray_NewFromDescr(&PyArray_Type, desc, 1, dims, NULL, data, flags, (PyObject*)self);
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
{
|
|
||||||
PyErr_SetNone(PyExc_NotImplementedError);
|
PyErr_SetNone(PyExc_NotImplementedError);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
static PyMethodDef pyField_methods[] = {
|
static PyMethodDef pyField_methods[] = {
|
||||||
{"name", (PyCFunction)pyField_name, METH_NOARGS,
|
{"name", (PyCFunction)pyField_name, METH_NOARGS,
|
||||||
|
Reference in New Issue
Block a user