EPICS Controls 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  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: mask for bitwise operation in CALC record
From: Dirk Zimoch <[email protected]>
To: haquin <[email protected]>
Cc: tech-talk <[email protected]>
Date: Tue, 05 Jun 2012 15:11:42 +0200
haquin wrote:
Hi,

I use a CALC record for bitwise operation for exemple : CALC="A & 0x001F"
with a Linux IOC everything is OK,
but with a VxWorks IOC I have the following error: Syntax error, unknown operator/operand in expression "(A & 0x001F)"

It seems that the 0x001F is not supported, right ?

Yes.


could it be changed ?

Yes.


regards.


That happens because strtod() accepts hex numbers in Linux but not in vxWorks.

Linux:
man strtod:
"The expected form of the (initial portion of the) string is optional leading white space as recognized by isspace(3), an optional plus (‘‘+’’) or minus sign (‘‘-’’) and then either (i) a decimal number, or (ii) a hexadecimal number, or (iii) an infinity, or (iv) a NAN (not-a- number)."


vxWorks 5.5 strtod documentation:
"The expected form of the subject sequence is an optional plus or minus decimal-point character, then an optional exponent part but no floating suffix. The subject sequence is defined as the longest initial subsequence of the input string, starting with the first non-white-space character, that is of the expected form. The subject sequence contains no characters if the input string is empty or consists entirely of white space, or if the first non-white-space character is other than a sign, a digit, or a decimal-point character."

I think adding something like this to epicsStrtod should fix the problem:

if (epicsStrnCaseCmp("0x", cp, 2) == 0) {
  return (double)strtoul(str, endp, 16);
}

Dirk







Replies:
Re: mask for bitwise operation in CALC record Eric Norum
References:
mask for bitwise operation in CALC record haquin

Navigate by Date:
Prev: a MEDM replacement Mezger Anton Christian
Next: RE: a MEDM replacement Mark Rivers
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: mask for bitwise operation in CALC record haquin
Next: Re: mask for bitwise operation in CALC record Eric Norum
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 18 Nov 2013 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·