/* 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
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