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
- Replies:
- Re: waveform of STRING memory structure Pavel Masloff
- References:
- waveform of STRING memory structure Pavel Masloff
- Navigate by Date:
- Prev:
waveform of STRING memory structure Pavel Masloff
- Next:
Re: waveform of STRING memory structure Pavel Masloff
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
<2012>
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
waveform of STRING memory structure Pavel Masloff
- Next:
Re: waveform of STRING memory structure Pavel Masloff
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
<2012>
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
|