g+
g+ Communities
Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014 
<== Date ==> <== Thread ==>

Subject: Re: How to get array of strings from waveform record?
From: Nerses Gevorgyan <nerses@jlab.org>
To: tech-talk@aps.anl.gov
Date: Tue, 14 Feb 2012 14:51:53 -0500
Sure, this helps.
I modified as suggested and it works. Thanks a lot.

BTW, it wound be nice to have in the Record Reference Wiki an examples.
Like in the "MySQL reference manual", where for every command people post their examples, sometimes not trivial examples. Later people could use them instead of starting from scratch.

Probably, a similar thing exists already, but I don't know the place.

Regards,
Nerses



On 02/14/2012 01:34 PM, Andrew Johnson wrote:
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


Replies:
Re: How to get array of strings from waveform record? Andrew Johnson
References:
How to get array of strings from waveform record? Nerses Gevorgyan
Re: How to get array of strings from waveform record? Andrew Johnson

Navigate by Date:
Prev: epics-arduino Emmanuel Mayssat
Next: Re: epics-arduino Marty Smith
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014 
Navigate by Thread:
Prev: Re: How to get array of strings from waveform record? Benjamin Franksen
Next: Re: How to get array of strings from waveform record? Andrew Johnson
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014 
ANJ, 18 Nov 2013 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· EPICSv4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·