Argonne National Laboratory

Experimental Physics and
Industrial Control System

2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <2017 Index 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <2017
<== Date ==> <== Thread ==>

Subject: Re: Concerns about link-support-2 branch
From: Andrew Johnson <anj@aps.anl.gov>
To: Michael Davidsaver <mdavidsaver@gmail.com>
Cc: EPICS core-talk <core-talk@aps.anl.gov>
Date: Thu, 9 Mar 2017 14:39:32 -0600
On 03/08/2017 06:50 PM, Michael Davidsaver wrote:
> Sort of... maybe.  Perhaps you could give it a spin in an actual device
> support?  How would you use this to replicate my aSub which returns the
> first non-INVALID input?  I'm interested how/if you can avoid copying in
> the input values twice (minor for scalars, not so far arrays).

See attached.

There is still the limitation that the aSub process() routine gets all
of the INPx links before it calls the user's routine, and I'm not
checking that the A-… fields are configured as strings (causing the INPx
CA subscriptions to be strings), but this should do what you want (again
this is not tested, and in this case I haven't even tried to compile it).

- Andrew

-- 
Arguing for surveillance because you have nothing to hide is no
different than making the claim, "I don't care about freedom of
speech because I have nothing to say." -- Edward Snowdon
static long try_input(struct link *plink, void *priv)
{
    epicsEnum16 sevr, stat;
    long opts = 0, nReq = 1;
    if (dbGetAlarm(plink, &sevr, &stat))
        return -1;
    if (sevr != NO_ALARM)
        return -1;
    return dbGetLink(plink, DBR_STRING, priv, opts, nReq);
}

static
long select_string(aSubRecord *prec)
{
    unsigned i;
    DBLINK *L = &prec->inpa;
    char *out = prec->vala;

    /* find the first input w/o an active alarm */
    for (i = 0; i < NINPUTS; i++) {
        if (!dbLinkDoLocked(&L[i], try_input, out))
            return 0;
    }

    out[0] = '\0';
    (void)recGblSetSevr(prec, READ_ALARM, INVALID_ALARM);
    return 0;
}

References:
Concerns about link-support-2 branch Andrew Johnson
Re: Concerns about link-support-2 branch Michael Davidsaver
Re: Concerns about link-support-2 branch Johnson, Andrew N.
Re: Concerns about link-support-2 branch Michael Davidsaver
Re: Concerns about link-support-2 branch Andrew Johnson
Re: Concerns about link-support-2 branch Michael Davidsaver

Navigate by Date:
Prev: Re: Concerns about link-support-2 branch Michael Davidsaver
Next: epicsExport.h on Windows Ralph Lange
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <2017
Navigate by Thread:
Prev: Re: Concerns about link-support-2 branch Michael Davidsaver
Next: dllPath.bat problem Mark Rivers
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <2017
ANJ, 21 Mar 2017 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·