Minor fixes to the calc link-type

This commit is contained in:
Andrew Johnson
2016-09-03 22:24:55 -05:00
parent 25315882ec
commit 4302da3628
2 changed files with 9 additions and 6 deletions

View File

@@ -101,7 +101,7 @@ link(calc, lnkCalcIf)
Calculation links can perform simple mathematical expressions on scalar
(double-precision floating-point) values obtained from other link types and
return a single double-precision floating-point result. The expressions are
evaluated by the EPICS Calc engine, and up to 12 input links can be used.
evaluated by the EPICS Calc engine, and up to 12 inputs can be provided.
=head4 Parameters
@@ -111,7 +111,7 @@ The link value is a map with the following keys:
=item expr
The expression to be evaluated, provided as a string.
The primary expression to be evaluated, provided as a string.
=item major
@@ -125,7 +125,8 @@ An optional expression that returns non-zero to raise a minor alarm.
A JSON list of up to 12 input arguments for the expression, which are assigned
to the inputs C<A>, C<B>, C<C>, ... C<L>. Each input argument may be either a
numeric literal or an embedded link inside C<{}> braces.
numeric literal or an embedded JSON link inside C<{}> braces. The same input
values are provided to the two alarm expressions as to the primary expression.
=item units

View File

@@ -31,7 +31,7 @@
typedef long (*FASTCONVERT)();
/* Change 'undef' to 'define' to turn on debug statements: */
#define DEBUG_LINK
#undef DEBUG_LINK
#ifdef DEBUG_LINK
int lnkCalcDebug = 10;
@@ -200,7 +200,7 @@ static jlif_key_result lnkCalc_start_map(jlink *pjlink) {
calc_link *clink = CONTAINER(pjlink, struct calc_link, jlink);
IFDEBUG(10)
printf("lnkCalc_start_array(calc@%p)\n", pjlink);
printf("lnkCalc_start_map(calc@%p)\n", pjlink);
if (clink->pstate == ps_args)
return jlif_key_child_link;
@@ -256,7 +256,7 @@ static jlif_result lnkCalc_end_map(jlink *pjlink) {
calc_link *clink = CONTAINER(pjlink, struct calc_link, jlink);
IFDEBUG(10)
printf("lnkCalc_end_array(calc@%p)\n", pjlink);
printf("lnkCalc_end_map(calc@%p)\n", pjlink);
if (clink->pstate == ps_error)
return jlif_stop;
@@ -340,6 +340,7 @@ static void lnkCalc_open(struct link *plink)
child->precord = plink->precord;
dbJLinkInit(child);
dbLoadLink(child, DBR_DOUBLE, &clink->arg[i]);
}
}
@@ -431,6 +432,7 @@ static long lnkCalc_getValue(struct link *plink, short dbrType, void *pbuffer,
long nReq = 1;
dbGetLink(child, DBR_DOUBLE, &clink->arg[i], NULL, &nReq);
/* FIXME Should we look at the return status from dbGetLink? */
}
clink->stat = 0;
clink->sevr = 0;