Hi Matt,
On Wednesday 22 September 2010 09:56:55 Matt Newville wrote:
> OK, I was able to reproduce the problem on a linux x86_64 machine.
> For Python, I see that
>
> >>> import ctypes
> >>> ctypes.c_long == ctypes.c_int
>
> is True on 32 bit systems but is False on 64-bit linux. As I said, I
> was mapping Epcics DBR_LONG to a ctypes.c_long. My suspicion is that
> an Epics DBR_LONG is actually not a "long" on 64-bit machines, but a
> 32-bit integer, which is to say an int. Perhaps someone can confirm,
> correct, or clarify this.
That is correct, there was too much EPICS software that assumed a DBR_LONG was
always 32 bits, so we map DBR_LONG (and DBF_LONG inside the IOC) to an
epicsInt32 which is our architecture-independent typedef. If someone needs
anything longer I'd suggest using a DBR_DOUBLE, which can accurately represent
all integers up to 52 bits long (above that you can find that x+1 == x).
> I use ctypes.c_long and ctypes.c_ulong all over dbr.py for the mapping
> of various CA structures, including event and connection handling and
> in the more complex data (DBR_CTRL_XXX, etc). But callbacks and at
> least some complex data types appear to be working, so some portions
> of these structures must really be longs. I'll have to do more
> testing on 64-bit machines to better sample over all the mappings of
> the C structures.
Things might appear to work on little-endian machines but not on big-endian or
vice versa; test this on both (Sparc or PowerPC) and x86 families if you can.
The DBR_XXX_LONG structures do use 32-bit values for the limit values.
On a related subject, be aware that in a DBR_CTRL_DOUBLE the alarm limits will
be NaN values if the relevent xxSV field is NO_ALARM; you might want to make
sure that Python handles them properly.
- Andrew
--
The best FOSS code is written to be read by other humans -- Harald Welte
- Replies:
- Re: pyepics bug (need fix asap!) + Matthew Newville? Matt Newville
- References:
- pyepics bug (need fix asap!) + Matthew Newville? emmanuel_mayssat
- Re: pyepics bug (need fix asap!) + Matthew Newville? emmanuel_mayssat
- Re: pyepics bug (need fix asap!) + Matthew Newville? Matt Newville
- Navigate by Date:
- Prev:
Re: pymsi - a python alternative to msi Andrew Johnson
- Next:
Re: pyepics bug (need fix asap!) + Matthew Newville? emmanuel_mayssat
- 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:
Re: pyepics bug (need fix asap!) + Matthew Newville? Matt Newville
- Next:
Re: pyepics bug (need fix asap!) + Matthew Newville? Matt Newville
- 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
|