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  2012  2013  2014  2015  2016  <2017 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
<== Date ==> <== Thread ==>

Subject: Re: Replacement for dbGetPdbAddrFromLink ?
From: "Stubbs, Scott A." <sstubbs@slac.stanford.edu>
To: "Dunning, Michael" <mdunning@slac.stanford.edu>
Cc: "Condamoor, Shantha" <scondam@slac.stanford.edu>, EPICS Tech-Talk <tech-talk@aps.anl.gov>
Date: Tue, 8 Aug 2017 20:25:48 +0000
Hi, I would be interested in this as well.  We have an IOC talking to an MKS RGA which also uses this macro:

    /* Get the pointer to the record in INPB.
   * Is this a valid pv? If so, then verify that data type is double, and check that it's a waveform. 
   */
  pAddr = dbGetPdbAddrFromLink(&psub->inpc);
  if (!pAddr || (pAddr->field_type != DBF_DOUBLE) || (pAddr->no_elements == 1))
    return(ERROR);

  /* Create an array of 2 pointers */
  pdev = (intArrayOut_ts *)calloc(sizeof(intArrayOut_ts),1);
  if (!pdev)
  {
    recGblRecordError(S_rec_outMem,(void *)psub,"sub: init_record");
    return(ERROR);
  }

  /* Set the private data information */
  pwf  = (waveformRecord *)pAddr->precord;
  pdev->preadings = (double *)pAddr->pfield; /* ptr to data <DEVICE>:IVB */
  pdev->pnord = &pwf->nord;                  /* ptr to # of wf items     */
  pdev->nelem = pAddr->no_elements;          /* max number of data elements in record   */

Thanks,
Scott
---
Scott Stubbs
LCLS Controls & Data Systems
sstubbs@slac.stanford.edu




On 4 Aug 2017, at 12:43 pm, Dunning, Michael <mdunning@slac.stanford.edu> wrote:

I'm failing to come up with a clever way of replacing
dbGetPdbAddrFromLink, which was removed in base 3.15.  It was defined
as a macro in dbAccessDefs.h as this:

#define dbGetPdbAddrFromLink(PLNK) \
( ( (PLNK)->type != DB_LINK ) \
? 0 \
: ( ( (struct dbAddr *)( (PLNK)->value.pv_link.pvt) ) ) )


I can redefine this macro in my source code as the above, but is there
a better way of replacing its functionality, perhaps with a different
macro or function call?

Here's an example of how we were using it:

...
DBADDR *cntAddr = dbGetPdbAddrFromLink(&psub->inpi);
short *cntP;
long cntNord, offset;
struct rset *prset;

if (!cntAddr) return -1;
dbScanLock(cntAddr->precord);
if ((cntAddr->field_type == DBF_SHORT) && ((prset = dbGetRset(cntAddr)))) {
   cntP = (short *)cntAddr->pfield;
   if (!cntP) cntNord = 0;
   else (*prset->get_array_info)(cntAddr, &cntNord, &offset);
} else {
   cntP    = 0;
   cntNord = 0;
}
dbScanUnlock(cntAddr->precord);
...


This is for some rather critical systems, so we're trying at all costs
to avoid surprise runtime errors.

Any suggestions are much appreciated.

Mike



Michael Dunning
SLAC National Accelerator Laboratory
Accelerator Research Division Test Facilities
2575 Sand Hill Road, MS 63
Menlo Park, CA 94025
+1 (650) 926-5200


Replies:
Re: Replacement for dbGetPdbAddrFromLink ? Michael Davidsaver
References:
Replacement for dbGetPdbAddrFromLink ? Dunning, Michael

Navigate by Date:
Prev: Re: CA monitoring weirdness for status/severity Dohn Arms
Next: Re: Replacement for dbGetPdbAddrFromLink ? Michael Davidsaver
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
Navigate by Thread:
Prev: Replacement for dbGetPdbAddrFromLink ? Dunning, Michael
Next: Re: Replacement for dbGetPdbAddrFromLink ? Michael Davidsaver
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
ANJ, 09 Aug 2017 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·