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  2015  2016  2017  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017 
<== Date ==> <== Thread ==>

Subject: Re: waveform of STRING memory structure
From: Pavel Masloff <pavel.masloff@gmail.com>
To: Andrew Johnson <anj@aps.anl.gov>
Cc: tech-talk@aps.anl.gov
Date: Fri, 1 Jun 2012 00:58:53 +0400
Oh, now I understand. One can check by:

if (data[i]!=NULL) {}

or

if (isalnum(data[i]) || isspace(data[i])) {}

Thanks Andrew and Kay!!

Cheers,
Pavel

On Fri, Jun 1, 2012 at 12:51 AM, Pavel Masloff <pavel.masloff@gmail.com> wrote:
Thanks. I checked it out. That's correct.
How do clients (IOC subroutines) treat strings which are less than NELM, there will obviously be white spaces (or how is a waveform initialized?)



On Fri, Jun 1, 2012 at 12:42 AM, Andrew Johnson <anj@aps.anl.gov> wrote:
Hi Pavel,

On 2012-05-31 Pavel Masloff wrote:
> How is a waveform of strings represented in memory? As an array of pointers
> to char? Or as NELM consecutive 40 byte chars? Or less than 40 (depending
> on the size of each waveform element).
>
> This is what Kay suggests:
>
> *Not sure, but I would assume NELM consecutive 40 byte chars.
> This is how the memory is allocated in the waveform record:
>
> * *  prec->bptr = callocMustSucceed(prec->nelm, dbValueSize(prec->ftvl),
>            "waveform calloc failed");
>
> So it's one long area, and dbValueSize(STRING) is MAX_STRING_SIZE == 40.*
>
> Is it so?

Kay is correct; all array fields consist of a single buffer containing up to
NELM fixed-length elements.  A DBF_STRING is a fixed-length 40-character array
of chars (but just in case some site has privately decided to change the value
of MAX_STRING_SIZE always use that macro instead of the literal 40).  Therefor
an array of 10 STRINGs is a 400 character buffer where bytes 0 through 39 hold
the first element, bytes 40 through 79 hold the second and so on.

If what you're storing is really one long character string there is no
advantage in using a waveform of STRING data; it's better to just use a
waveform of CHAR type, which you can then use 'caget -S' to display.

HTH,

- Andrew
--
Never interrupt your enemy when he is making a mistake.
-- Napoleon Bonaparte



--
Best regards,


Pavel Maslov, MS
Controls Engineer at Pulsed power Lab
Efremov Institute for Electro-Physical Apparatus
St. Petersburg, Russia

Mobile: +7 (951) 672 22 19
Landline: +7 (812) 461 01 01




--
Best regards,


Pavel Maslov, MS
Controls Engineer at Pulsed power Lab
Efremov Institute for Electro-Physical Apparatus
St. Petersburg, Russia

Mobile: +7 (951) 672 22 19
Landline: +7 (812) 461 01 01


References:
waveform of STRING memory structure Pavel Masloff
Re: waveform of STRING memory structure Andrew Johnson
Re: waveform of STRING memory structure Pavel Masloff

Navigate by Date:
Prev: Re: waveform of STRING memory structure Pavel Masloff
Next: Re: waveform of STRING memory structure Andrew Johnson
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017 
Navigate by Thread:
Prev: Re: waveform of STRING memory structure Pavel Masloff
Next: Re: waveform of STRING memory structure Andrew Johnson
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017 
ANJ, 18 Nov 2013 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·