Merge branch '7.0' into PSI-7.0
This commit is contained in:
@@ -36,8 +36,6 @@
|
||||
#include "epicsExport.h"
|
||||
|
||||
|
||||
typedef long (*FASTCONVERT)();
|
||||
|
||||
typedef struct calc_link {
|
||||
jlink jlink; /* embedded object */
|
||||
int nArgs;
|
||||
@@ -558,7 +556,7 @@ static long lnkCalc_getValue(struct link *plink, short dbrType, void *pbuffer,
|
||||
dbCommon *prec = plink->precord;
|
||||
int i;
|
||||
long status;
|
||||
FASTCONVERT conv;
|
||||
FASTCONVERTFUNC conv;
|
||||
|
||||
if(INVALID_DB_REQ(dbrType))
|
||||
return S_db_badDbrtype;
|
||||
@@ -638,7 +636,7 @@ static long lnkCalc_putValue(struct link *plink, short dbrType,
|
||||
dbCommon *prec = plink->precord;
|
||||
int i;
|
||||
long status;
|
||||
FASTCONVERT conv;
|
||||
FASTCONVERTFUNC conv;
|
||||
|
||||
if(INVALID_DB_REQ(dbrType))
|
||||
return S_db_badDbrtype;
|
||||
|
||||
@@ -23,8 +23,6 @@
|
||||
#include "epicsExport.h"
|
||||
|
||||
|
||||
typedef long (*FASTCONVERT)();
|
||||
|
||||
typedef struct const_link {
|
||||
jlink jlink; /* embedded object */
|
||||
int nElems;
|
||||
@@ -458,7 +456,7 @@ static long lnkConst_loadArray(struct link *plink, short dbrType, void *pbuffer,
|
||||
short dbrSize;
|
||||
char *pdest = pbuffer;
|
||||
int nElems = clink->nElems;
|
||||
FASTCONVERT conv;
|
||||
FASTCONVERTFUNC conv;
|
||||
long status;
|
||||
|
||||
if(INVALID_DB_REQ(dbrType))
|
||||
@@ -495,9 +493,11 @@ static long lnkConst_loadArray(struct link *plink, short dbrType, void *pbuffer,
|
||||
}
|
||||
else {
|
||||
/* Long string conversion */
|
||||
strncpy(pbuffer, clink->value.scalar_string, *pnReq);
|
||||
((char *)pbuffer)[*pnReq] = 0;
|
||||
nElems = strlen(pbuffer) + 1;
|
||||
if (*pnReq > 0) {
|
||||
strncpy(pbuffer, clink->value.scalar_string, *pnReq);
|
||||
((char *)pbuffer)[*pnReq - 1] = 0;
|
||||
nElems = strlen(pbuffer) + 1;
|
||||
}
|
||||
status = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -34,8 +34,6 @@
|
||||
#include "epicsExport.h"
|
||||
|
||||
|
||||
typedef long (*FASTCONVERT)();
|
||||
|
||||
typedef struct state_link {
|
||||
jlink jlink; /* embedded object */
|
||||
char *name;
|
||||
@@ -143,7 +141,7 @@ static long lnkState_getValue(struct link *plink, short dbrType, void *pbuffer,
|
||||
{
|
||||
state_link *slink = CONTAINER(plink->value.json.jlink,
|
||||
struct state_link, jlink);
|
||||
FASTCONVERT conv;
|
||||
FASTCONVERTFUNC conv;
|
||||
|
||||
if(INVALID_DB_REQ(dbrType))
|
||||
return S_db_badDbrtype;
|
||||
|
||||
@@ -16,7 +16,7 @@ has a number of additional features:
|
||||
|
||||
=item *
|
||||
|
||||
It provides 20 different input and output fields which can hold array or
|
||||
It provides 21 different input and output fields which can hold array or
|
||||
scalar values.
|
||||
The types and array capacities of these are user configurable, and they all
|
||||
have an associated input or output link.
|
||||
|
||||
@@ -1160,7 +1160,7 @@ See next section.
|
||||
|
||||
=head2 C<special>
|
||||
|
||||
This is called id CALC or OCAL is changed. C<special> calls postfix.
|
||||
This is called if CALC or OCAL is changed. C<special> calls postfix.
|
||||
|
||||
=head2 C<get_units>
|
||||
|
||||
|
||||
@@ -149,13 +149,16 @@ static int compare(const void *arg1, const void *arg2)
|
||||
else return 1;
|
||||
}
|
||||
|
||||
#define min(a, b) ((a) < (b) ? (a) : (b))
|
||||
|
||||
static int compress_array(compressRecord *prec,
|
||||
double *psource, int no_elements)
|
||||
{
|
||||
epicsInt32 i,j;
|
||||
epicsInt32 j;
|
||||
epicsInt32 n, nnew;
|
||||
epicsInt32 nsam = prec->nsam;
|
||||
double value;
|
||||
epicsUInt32 samples_written = 0;
|
||||
double value = 0.0;
|
||||
|
||||
/* skip out of limit data */
|
||||
if (prec->ilil < prec->ihil) {
|
||||
@@ -167,61 +170,54 @@ static int compress_array(compressRecord *prec,
|
||||
}
|
||||
if (prec->n <= 0)
|
||||
prec->n = 1;
|
||||
if (no_elements < prec->n && prec->pbuf != menuYesNoYES)
|
||||
return 1; /*dont do anything*/
|
||||
n = no_elements;
|
||||
n = prec->n;
|
||||
|
||||
/* determine number of samples to take */
|
||||
if (no_elements < nsam * n)
|
||||
nnew = (no_elements / n);
|
||||
else nnew = nsam;
|
||||
nnew = min(no_elements, nsam * n);
|
||||
|
||||
/* compress according to specified algorithm */
|
||||
switch (prec->alg){
|
||||
case compressALG_N_to_1_Low_Value:
|
||||
/* compress N to 1 keeping the lowest value */
|
||||
for (i = 0; i < nnew; i++) {
|
||||
while (nnew > 0)
|
||||
{
|
||||
if (nnew < n && prec->pbuf != menuYesNoYES)
|
||||
break;
|
||||
|
||||
n = min(n, nnew);
|
||||
switch (prec->alg)
|
||||
{
|
||||
case compressALG_N_to_1_Low_Value:
|
||||
value = *psource++;
|
||||
for (j = 1; j < n; j++, psource++) {
|
||||
for (j = 1; j < n; j++, psource++)
|
||||
{
|
||||
if (value > *psource)
|
||||
value = *psource;
|
||||
}
|
||||
put_value(prec, &value, 1);
|
||||
}
|
||||
break;
|
||||
case compressALG_N_to_1_High_Value:
|
||||
/* compress N to 1 keeping the highest value */
|
||||
for (i = 0; i < nnew; i++){
|
||||
break;
|
||||
case compressALG_N_to_1_High_Value:
|
||||
value = *psource++;
|
||||
for (j = 1; j < n; j++, psource++) {
|
||||
for (j = 1; j < n; j++, psource++)
|
||||
{
|
||||
if (value < *psource)
|
||||
value = *psource;
|
||||
}
|
||||
put_value(prec, &value, 1);
|
||||
}
|
||||
break;
|
||||
case compressALG_N_to_1_Average:
|
||||
/* compress N to 1 keeping the average value */
|
||||
for (i = 0; i < nnew; i++) {
|
||||
value = 0;
|
||||
for (j = 0; j < n; j++, psource++)
|
||||
break;
|
||||
case compressALG_N_to_1_Average:
|
||||
value = *psource++;
|
||||
for (j = 1; j < n; j++, psource++)
|
||||
{
|
||||
value += *psource;
|
||||
value /= n;
|
||||
put_value(prec, &value, 1);
|
||||
}
|
||||
break;
|
||||
|
||||
case compressALG_N_to_1_Median:
|
||||
/* compress N to 1 keeping the median value */
|
||||
/* note: sorts source array (OK; it's a work pointer) */
|
||||
for (i = 0; i < nnew; i++, psource += nnew) {
|
||||
}
|
||||
value = value / n;
|
||||
break;
|
||||
case compressALG_N_to_1_Median:
|
||||
/* note: sorts source array (OK; it's a work pointer) */
|
||||
qsort(psource, n, sizeof(double), compare);
|
||||
value = psource[n / 2];
|
||||
put_value(prec, &value, 1);
|
||||
psource += n;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
nnew -= n;
|
||||
put_value(prec, &value, 1);
|
||||
samples_written++;
|
||||
}
|
||||
return 0;
|
||||
return (samples_written == 0);
|
||||
}
|
||||
|
||||
static int array_average(compressRecord *prec,
|
||||
|
||||
@@ -91,10 +91,10 @@ The BPTR field contains a pointer to the unsigned long array of frequency
|
||||
values. The VAL field references this array as well. However, the BPTR field is
|
||||
not accessible at run-time.
|
||||
|
||||
The MCNT field keeps counts the number of signal counts since the last monitor
|
||||
The MCNT field keeps the number of signal counts since the last monitor
|
||||
was invoked.
|
||||
|
||||
The collections controls field (CMD) is a menu field with five choices:
|
||||
The collections controls field (CMD) is a menu field with four choices:
|
||||
|
||||
=menu histogramCMD
|
||||
|
||||
@@ -110,8 +110,6 @@ array. Unlike C<Read>, it doesn't clear the array first.
|
||||
|
||||
The C<Stop> command disables the reading of signal values into the array.
|
||||
|
||||
The C<Setup> command waits until the C<start> or C<read> command has been issued
|
||||
to start counting.
|
||||
|
||||
The CSTA or collections status field implements the CMD field choices by
|
||||
enabling or disabling the reading of values into the histogram array. While
|
||||
|
||||
@@ -49,6 +49,9 @@ static long init_record(struct dbCommon *pcommon, int pass)
|
||||
if (sizv < 16) {
|
||||
sizv = 16; /* Enforce a minimum size for the VAL field */
|
||||
prec->sizv = sizv;
|
||||
} else if (sizv > 0x7fff) {
|
||||
sizv = 0x7fff; /* SIZV is unsigned, but dbAddr::field_size is signed */
|
||||
prec->sizv = sizv;
|
||||
}
|
||||
|
||||
prec->val = callocMustSucceed(1, sizv, "lsi::init_record");
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
=title Long String Input Record (lsi)
|
||||
|
||||
The long string input record is used to retrieve an arbitrary ASCII string with
|
||||
a maximum length of 65535 characters.
|
||||
a maximum length of 32767 characters.
|
||||
|
||||
This record type was included in base.dbd beginning with epics-base 3.15.0.2 .
|
||||
|
||||
@@ -36,7 +36,7 @@ from. It can be a database or channel access link, or a constant. If constant,
|
||||
the VAL field is initialized with the constant and can be changed via dbPuts.
|
||||
Otherwise, the string is read from the specified location each time the record
|
||||
is processed and placed in the VAL field. The maximum number of characters in
|
||||
VAL is given by SIZV, and cannot be larger than 65535. In addition, the
|
||||
VAL is given by SIZV, and cannot be larger than 32767. In addition, the
|
||||
appropriate device support module must be entered into the DTYP field.
|
||||
|
||||
=fields VAL, OVAL, SIZV, INP, DTYP
|
||||
|
||||
@@ -53,6 +53,9 @@ static long init_record(struct dbCommon *pcommon, int pass)
|
||||
if (sizv < 16) {
|
||||
sizv = 16; /* Enforce a minimum size for the VAL field */
|
||||
prec->sizv = sizv;
|
||||
} else if (sizv > 0x7fff) {
|
||||
sizv = 0x7fff; /* SIZV is unsigned, but dbAddr::field_size is signed */
|
||||
prec->sizv = sizv;
|
||||
}
|
||||
|
||||
prec->val = callocMustSucceed(1, sizv, "lso::init_record");
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
=title Long String Output Record (lso)
|
||||
|
||||
The long string output record is used to write an arbitrary ASCII string with a
|
||||
maximum length of 65535 characters.
|
||||
maximum length of 32767 characters.
|
||||
|
||||
This record type was included in base.dbd beginning with epics-base 3.15.0.2 .
|
||||
|
||||
@@ -41,7 +41,7 @@ C<supervisory> is specified, DOL is ignored, the current value of VAL is
|
||||
written, and VAL can be changed externally via dbPuts at run-time.
|
||||
|
||||
The maximum number of characters in VAL is given by SIZV, and cannot be larger
|
||||
than 65535.
|
||||
than 32767.
|
||||
|
||||
DOL can also be a constant instead of a link, in which case VAL is initialized
|
||||
to the constant value. Most simple string constants are likely to be interpreted
|
||||
|
||||
@@ -337,6 +337,9 @@ static long init_record(struct dbCommon *pcommon, int pass)
|
||||
if (sizv < 16) {
|
||||
sizv = 16; /* Enforce a minimum size for the VAL field */
|
||||
prec->sizv = sizv;
|
||||
} else if (sizv > 0x7fff) {
|
||||
sizv = 0x7fff; /* SIZV is unsigned, but dbAddr::field_size is signed */
|
||||
prec->sizv = sizv;
|
||||
}
|
||||
|
||||
prec->val = callocMustSucceed(1, sizv, "printf::init_record");
|
||||
|
||||
@@ -152,7 +152,7 @@ Specification|https://docs.epics-controls.org/en/latest/guides/EPICS_Process_Dat
|
||||
for information on specifying links.
|
||||
|
||||
The formatted string is written to the VAL field. The maximum number of
|
||||
characters in VAL is given by SIZV, and cannot be larger than 65535. The LEN
|
||||
characters in VAL is given by SIZV, and cannot be larger than 32767. The LEN
|
||||
field contains the length of the formatted string in the VAL field.
|
||||
|
||||
=fields FMT, INP0, INP1, INP2, INP3, INP4, INP5, INP6, INP7, INP8, INP9, VAL, SIZV, LEN
|
||||
|
||||
@@ -17,10 +17,12 @@
|
||||
|
||||
#include <epicsGetopt.h>
|
||||
#include "registryFunction.h"
|
||||
#include "errlog.h"
|
||||
#include "epicsThread.h"
|
||||
#include "epicsExit.h"
|
||||
#include "epicsStdio.h"
|
||||
#include "epicsString.h"
|
||||
#include "errlog.h"
|
||||
#include "dbStaticLib.h"
|
||||
#include "subRecord.h"
|
||||
#include "dbAccess.h"
|
||||
@@ -92,7 +94,7 @@ void usage(const char *arg0, const std::string& base_dbd) {
|
||||
"interactive IOC shell.\n"
|
||||
"\n"
|
||||
"Compiled-in path to softIoc.dbd is:\n"
|
||||
"\t"<<base_dbd.c_str()<<"\n";
|
||||
"\t"<<base_dbd.c_str()<<std::endl;
|
||||
}
|
||||
|
||||
void errIf(int ret, const std::string& msg)
|
||||
@@ -239,7 +241,9 @@ int main(int argc, char *argv[])
|
||||
if (loadedDb) {
|
||||
if (verbose)
|
||||
std::cout<<"iocInit()\n";
|
||||
iocInit();
|
||||
if(iocInit()) {
|
||||
std::cerr<<ERL_ERROR " during iocInit()"<<std::endl;
|
||||
}
|
||||
epicsThreadSleep(0.2);
|
||||
}
|
||||
|
||||
@@ -270,7 +274,8 @@ int main(int argc, char *argv[])
|
||||
return 0;
|
||||
|
||||
}catch(std::exception& e){
|
||||
std::cerr<<"Error: "<<e.what()<<"\n";
|
||||
errlogFlush();
|
||||
std::cerr<<ERL_ERROR ": "<<e.what()<<"\n";
|
||||
epicsExit(2);
|
||||
return 2;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user