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

Subject: aSub and zero length arrays
From: Michael Davidsaver <mdavidsaver@bnl.gov>
To: "tech-talk@aps.anl.gov" <tech-talk@aps.anl.gov>
Date: Tue, 18 Oct 2011 11:09:06 -0400
I've stumbled onto an interesting behavior of aSub. I want to write a function which takes a CHAR array as input (a long string). Sometimes the string can legitimately be empty (length 0). What I find is that when the the input should go from non-empty to empty it does not, and instead keeps the previous value.

In aSubRecord.c I see the following

for (i = 0; i < NUM_ARGS; i++) {
        long nRequest = (&prec->noa)[i];
status = dbGetLink(&(&prec->inpa)[i], (&prec->fta)[i], (&prec->a)[i], 0,
&nRequest);
        if (nRequest > 0)
            (&prec->nea)[i] = nRequest;
        if (status)
            return status;
    }

http://bazaar.launchpad.net/~epics-core/epics-base/3.15/view/head:/src/std/rec/aSubRecord.c#L321

I think what I am seeing is due to the "if (nRequest > 0)" test.

Is it ever the case that status==0 and nRequest==0 is used to signal an error? If not then can this be changed? Perhaps to:


for (i = 0; i < NUM_ARGS; i++) {
        long nRequest = (&prec->noa)[i];
status = dbGetLink(&(&prec->inpa)[i], (&prec->fta)[i], (&prec->a)[i], 0,
&nRequest);
        if (status)
            return status;
        else
            (&prec->nea)[i] = nRequest;
    }

It looks like subArray does the right thing. However, soft device support for waveform, and aai don't. They actually ignore status completely!

http://bazaar.launchpad.net/~epics-core/epics-base/3.15/view/head:/src/std/dev/devWfSoft.c#L72

Regards,
Michael


Replies:
Re: aSub and zero length arrays Andrew Johnson

Navigate by Date:
Prev: Re: Fwd: FW: EPICS driver for acqiris cPCI digitizer is available on epics.sf.net Silver
Next: Re: aSub and zero length arrays Andrew Johnson
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019  2020 
Navigate by Thread:
Prev: Re: Fwd: FW: EPICS driver for acqiris cPCI digitizer is available on epics.sf.net Silver
Next: Re: aSub and zero length arrays Andrew Johnson
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019  2020 
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 ·