EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  <19971998  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  Index 1994  1995  1996  <19971998  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 
<== Date ==> <== Thread ==>

Subject: change in promotion of types from database to channel access
From: Chip Watson <[email protected]>
To: [email protected]
Date: Wed, 16 Jul 1997 15:29:11 -0400
------- Forwarded Message

Chip Watson wrote:
> 
> Marty & Jeff,
> 
> We are having a problem with cdev access to DBR_USHORT's since cdev fetches
> all data in native type.  A while back you (Marty) said:
> 
>     Because old database access doesnt know about unsigned quantities
>     the interface between old and new database access tells the user that
>     the native field type for USHORT is float and for ULONG is double.
>     Thus BURT asks for USHORTS with DBR_FLOAT and ULONGs with DBR_DOUBLE
>     (this was done to prevent large positive numbers from appearing as
>     negative numbers).
> 
> Have you considered returning USHORT as LONG instead of FLOAT?  Or is a better
> fix in the works?

For 3.13 the mapping is now:

unsigned short dbDBRnewToDBRold[newDBR_ENUM+1] = {
        0, /*DBR_STRING to DBR_STRING*/
        4, /*DBR_CHAR to DBR_CHAR*/
        4, /*DBR_UCHAR to DBR_CHAR*/
        1, /*DBR_SHORT to DBR_SHORT*/
        5, /*DBR_USHORT to DBR_LONG*/
        5, /*DBR_LONG to DBR_LONG*/
        6, /*DBR_ULONG to DBR_DOUBLE*/
        2, /*DBR_FLOAT to DBR_FLOAT*/
        6, /*DBR_DOUBLE to DBR_DOUBLE*/
        3, /*DBR_ENUM to DBR_ENUM*/
};
#endif /*DB_TEXT_GLBLSOURCE*/

Thus USHORT is now mapped as LONG. Thus was not true in 3.12.
This solves most of the problems because MANY fields
are unsigned short. It still leaves the mask value fields of
the binary records as the major problem area.
 

> The problem we have is with any USHORT or ULONG appearing in cdev as floats
> instead of the integers they actually are.  Possible fixes:
> 
>         1) patch all .ASCII to remove all use of USHORT and ULONG
>            (very ugly with unknown side effects)
> 
>         2) change the promotions of CA to use LONG for both of these types,
>            with the possibility of errors for numbers greater than 2^31
>            (a pretty much impossible scenario, and easily handled on the
>            client side by simply casting it back to unsigned).
> 
>         3) putting ugly patches into cdev so that if the native type is
>            USHORT or ULONG, ask for conversion to LONG.
> 
> Recommendations?  I lean towards choice 2.  Any recommendations as to how to
> implement this change -- i.e. what file(s) need changing, etc.?

I have no big objection to mapping ULONG to LONG.
As you state the will cause problems for number > 2^31 but that side
effect may not be worse then existing side effects.

Before we make this change, however, I think it should be proposed to
tech-talk and see if there are any major objections.

Marty

------- End of Forwarded Message

So, I would like to propose changing the ULONG mapping to LONG, so that it
can be fetched in native type and correctly recognized as being an integer.

Comments?

Chip




Navigate by Date:
Prev: Re: InitHooks Marty Kraimer
Next: database check in R3.13.0 Rolf Keitel
Index: 1994  1995  1996  <19971998  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: IOC's for new project Hammonds, John
Next: RE: change in promotion of types from database to channel access Jeff Hill
Index: 1994  1995  1996  <19971998  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 
ANJ, 10 Aug 2010 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·