Experimental Physics and Industrial Control System
|
Hi Andy,
On 7/26/22 6:53 PM, Wang, Andrew via
Tech-talk wrote:
Update. I think I got it. I had to do the following.
static
long func(aSubRecord *prec)
{
DBLINK inpa = prec->inpa;
char *rec_name = inpa.value.pv_link.pvname;
printf("Record name in INPA is %s\n", rec_name);
return 0;
}
A DBLINK is a
structure (not a pointer) so your first line of code is copying data
that you don't need to do, and the value.pvlink union member is only valid
for certain kinds of link, so I would suggest something like this,
which adds protection from that by only showing DB and CA links:
static long
func(aSubRecord *prec)
{
DBLINK *plink = &prec->inpa;
if (plink->type == DB_LINK || plink->type == CA_LINK) {
const char *target = plink->value.pv_link.pvname;
printf("Record %s.INPA links to %s\n", prec->name, target);
}
return 0;
}
HTH,
- Andrew
From: Wang,
Andrew
Sent: Tuesday, July 26, 2022 4:17 PM
To: EPICS tech-talk <tech-talk at aps.anl.gov>
Subject: Retrieving record name from aSub input/output
fields
Hi all,
Quick question this time. I was
wondering if there was a way to retrieve the name of the
record referenced in an OUTLINK/INLINK field such as INPA,
OUTA, etc. in the aSub routine.
For instance, suppose I had an aSub
record such as the following.
record(aSub, “example”)
{
field(SNAM, “func”)
field(INPA,
“rec_in_inpa”)
}
I would like to be able to print the
name of the record in INPA within “func”.
static long func(aSubRecord *prec)
{
char *rec_name =
prec->____;
printf(“Record name in
INPA is %s\n”, rec_name);
return 0;
}
Thanks,
Andy
Purple ribbon awareness
--
Complexity comes for free, Simplicity you have to work for.
- References:
- Retrieving record name from aSub input/output fields Wang, Andrew via Tech-talk
- Re: Retrieving record name from aSub input/output fields Wang, Andrew via Tech-talk
- Navigate by Date:
- Prev:
Re: Retrieving record name from aSub input/output fields Michael Davidsaver via Tech-talk
- Next:
Re: Retrieving record name from aSub input/output fields Wang, Andrew via Tech-talk
- 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
2018
2019
2020
2021
<2022>
2023
2024
- Navigate by Thread:
- Prev:
Re: Retrieving record name from aSub input/output fields Michael Davidsaver via Tech-talk
- Next:
PVA and Docker on Mac Juan F. Esteban Müller via Tech-talk
- 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
2018
2019
2020
2021
<2022>
2023
2024
|
ANJ, 14 Sep 2022 |
·
Home
·
News
·
About
·
Base
·
Modules
·
Extensions
·
Distributions
·
Download
·
·
Search
·
EPICS V4
·
IRMIS
·
Talk
·
Bugs
·
Documents
·
Links
·
Licensing
·
|