Long ints, strings and calcout - #50
Conversation
This version enables use of long integers and strings.
| } | ||
| if (self->addr.special == SPC_MOD) | ||
| /* This is needed for long string support. */ | ||
| if (prset = dbGetRset(&self->addr)) |
There was a problem hiding this comment.
../dbfield.c: In function ‘pyField_putval’:
../dbfield.c:332:17: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
332 | if (prset = dbGetRset(&self->addr))
| ^~~~~
there is a compiler warning here. Could you add the extra parentheses to get rid of it?
|
Nice! This looks good to me. Maybe could add a calcout test to test_db.py I suggest we get the windows PR merged first #51 and then rebase this PR and merge it after? Since both PRs touch |
Removed use of assign-within-condition.
|
| if(elemsize!=PyArray_ITEMSIZE(aval)) { | ||
| PyErr_Format(PyExc_AssertionError, "item size mismatch %u %u", | ||
| elemsize, (unsigned)PyArray_ITEMSIZE((PyArrayObject *)aval)); | ||
| Py_DECREF(aval); |
There was a problem hiding this comment.
I think Py_DECREF(aval); is required to avoid a memory leak. That was added here: eafb208
Thanks!
Yes I agree. Well let's plan to merge windows PR first, maybe give it a couple more days in case anyone else wants to weigh in. It looks like the commit to add the calcout tests made serveral more changes in |
This PR incorporates and supercedes #30
In dbfield.c, the previous version incorrectly defines INT64 and UINT64 epicsInt32 and epicsUInt32.
This meant that values outside the 32-bit range were lost.
For long strings, the size is not fixed as MAX_STRING_SIZE (40) but variable.
For short strings, addr.field_size is MAX_STRING_SIZE, so remains the same.
For long strings, special runtime processing is required as identified by the SPC_MOD flag.
In devsupapp\src\makefile, the new _dbapi.dbd, _int64.dbd and _lsilso.dbd files are copied to the PY install directory.
In Init.py, these files are used in replacement of the previous use of a temporary database file created on-the-fly.
I have made this change for three reasons:
In test_dnb.py I have added suitable tests for long strings, ints and calcout.