From 4302da36281ecac0a01c8175ead4401eea65493e Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Sat, 3 Sep 2016 22:24:55 -0500 Subject: [PATCH] Minor fixes to the calc link-type --- src/std/link/links.dbd.pod | 7 ++++--- src/std/link/lnkCalc.c | 8 +++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/std/link/links.dbd.pod b/src/std/link/links.dbd.pod index facfb9106..8ae5c3f56 100644 --- a/src/std/link/links.dbd.pod +++ b/src/std/link/links.dbd.pod @@ -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, C, C, ... C. 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 diff --git a/src/std/link/lnkCalc.c b/src/std/link/lnkCalc.c index 6544898e4..b596471aa 100644 --- a/src/std/link/lnkCalc.c +++ b/src/std/link/lnkCalc.c @@ -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;