Hi Nerses,
On 2012-02-14 Nerses Gevorgyan wrote:
I'm trying to put into waveform record an array of STRINGs.
As I understood from waveform code and manual the VAL field is
a void pointer which should be supplied by user.
Sorry, if that's what the record reference manual says it's wrong.
The prec->val field is never actually used inside the record source code.
When you the access the VAL field of a waveform record through CA or a
database link, the data is actually fetched from the prec->bptr field, which
gets initialized in the first pass of record initialization to a point to a
buffer that holds NELM values of the type FTVL. Device support should copy
its data into this buffer, never modify the prec->bptr field itself.
For a case of array of STRINGs it could have different organizations. Like:
1) elements delimited by NULLes
aaa\0bbbbbb\0cc\0...
2) each element of array has a fixed length chars and the names then
padded with NULL-es like below
aaa\0\0\0\0\0\0\0bbbbbb\0\0\0\0cc\0\0\0\0\0\0\0\0
When FTVL=STRING the array elements are all MAX_STRING_SIZE=40 characters
long, thus when NELM=2 the buffer is 80 bytes long and the second string
element starts at offset 40 into the buffer.
Hope this helps,
- Andrew