Пример #1
0
static long get_control_double(DBADDR *paddr, struct dbr_ctrlDouble *pcd)
{
    subArrayRecord *prec = (subArrayRecord *) paddr->precord;

    switch (dbGetFieldIndex(paddr)) {
    case subArrayRecordVAL:
        pcd->upper_ctrl_limit = prec->hopr;
        pcd->lower_ctrl_limit = prec->lopr;
        break;

    case subArrayRecordINDX:
        pcd->upper_ctrl_limit = prec->malm - 1;
        pcd->lower_ctrl_limit = 0;
        break;

    case subArrayRecordNELM:
        pcd->upper_ctrl_limit = prec->malm;
        pcd->lower_ctrl_limit = 1;
        break;

    default:
        recGblGetControlDouble(paddr, pcd);
    }

    return 0;
}
Пример #2
0
static long get_graphic_double(DBADDR *paddr, struct dbr_grDouble *pgd)
{
    subArrayRecord *prec = (subArrayRecord *) paddr->precord;

    switch (dbGetFieldIndex(paddr)) {
    case subArrayRecordVAL:
        pgd->upper_disp_limit = prec->hopr;
        pgd->lower_disp_limit = prec->lopr;
        break;

    case subArrayRecordINDX:
        pgd->upper_disp_limit = prec->malm - 1;
        pgd->lower_disp_limit = 0;
        break;

    case subArrayRecordNELM:
        pgd->upper_disp_limit = prec->malm;
        pgd->lower_disp_limit = 1;
        break;

    default:
        recGblGetGraphicDouble(paddr, pgd);
    }

    return 0;
}
Пример #3
0
static long get_control_double(DBADDR *paddr,struct dbr_ctrlDouble *pcd)
{
    longoutRecord *prec=(longoutRecord *)paddr->precord;

    switch (dbGetFieldIndex(paddr)) {
        case indexof(VAL):
        case indexof(HIHI):
        case indexof(HIGH):
        case indexof(LOW):
        case indexof(LOLO):
        case indexof(LALM):
        case indexof(ALST):
        case indexof(MLST):
            /* do not change pre drvh/drvl behavior */
            if(prec->drvh > prec->drvl) {
                pcd->upper_ctrl_limit = prec->drvh;
                pcd->lower_ctrl_limit = prec->drvl;
            } else {
                pcd->upper_ctrl_limit = prec->hopr;
                pcd->lower_ctrl_limit = prec->lopr;
            }
            break;
        default:
            recGblGetControlDouble(paddr,pcd);
    }
    return(0);
}
Пример #4
0
static long get_graphic_double(DBADDR *paddr, struct dbr_grDouble *pgd)
{
    subRecord *prec = (subRecord *)paddr->precord;
    int fieldIndex = dbGetFieldIndex(paddr);

    switch (fieldIndex) {
    case subRecordVAL:
    case subRecordHIHI:     case subRecordHIGH:
    case subRecordLOW:      case subRecordLOLO:
    case subRecordA:        case subRecordB:
    case subRecordC:        case subRecordD:
    case subRecordE:        case subRecordF:
    case subRecordG:        case subRecordH:
    case subRecordI:        case subRecordJ:
    case subRecordK:        case subRecordL:
    case subRecordLA:       case subRecordLB:
    case subRecordLC:       case subRecordLD:
    case subRecordLE:       case subRecordLF:
    case subRecordLG:       case subRecordLH:
    case subRecordLI:       case subRecordLJ:
    case subRecordLK:       case subRecordLL:
        pgd->upper_disp_limit = prec->hopr;
        pgd->lower_disp_limit = prec->lopr;
        break;

    default:
        recGblGetGraphicDouble(paddr, pgd);
    }
    return 0;
}
Пример #5
0
static long get_control_double(struct dbAddr *paddr,
                               struct dbr_ctrlDouble *pcd)
{
    epidRecord   *pepid=(epidRecord *)paddr->precord;
    int fieldIndex = dbGetFieldIndex(paddr);

    if (
        fieldIndex == epidRecordVAL
        || fieldIndex == epidRecordHIHI
        || fieldIndex == epidRecordHIGH
        || fieldIndex == epidRecordLOW
        || fieldIndex == epidRecordLOLO
        || fieldIndex == epidRecordCVAL) {
        pcd->upper_ctrl_limit = pepid->hopr;
        pcd->lower_ctrl_limit = pepid->lopr;
    } else if (
        fieldIndex == epidRecordOVAL
        || fieldIndex == epidRecordP
        || fieldIndex == epidRecordI
        || fieldIndex == epidRecordD) {
        pcd->upper_ctrl_limit = pepid->drvh;
        pcd->lower_ctrl_limit = pepid->drvl;
    } else recGblGetControlDouble(paddr,pcd);
    return(0);
}
Пример #6
0
static long get_control_double(dbAddr *paddr, struct dbr_ctrlDouble *pcd)
{
	acalcoutRecord	*pcalc=(acalcoutRecord *)paddr->precord;
	int fieldIndex = dbGetFieldIndex(paddr);

	switch (fieldIndex) {
	case acalcoutRecordVAL:
	case acalcoutRecordHIHI:
	case acalcoutRecordHIGH:
	case acalcoutRecordLOW:
	case acalcoutRecordLOLO:
		pcd->upper_ctrl_limit = pcalc->hopr;
		pcd->lower_ctrl_limit = pcalc->lopr;
		return(0);
	default:
		break;
    } 

	if (fieldIndex >= acalcoutRecordA && fieldIndex <= acalcoutRecordL) {
		pcd->upper_ctrl_limit = pcalc->hopr;
		pcd->lower_ctrl_limit = pcalc->lopr;
		return(0);
	}
	if (fieldIndex >= acalcoutRecordPA && fieldIndex <= acalcoutRecordPL) {
		pcd->upper_ctrl_limit = pcalc->hopr;
		pcd->lower_ctrl_limit = pcalc->lopr;
		return(0);
	}
	return(0);
}
Пример #7
0
/*****************************************************************************
 *
 * Allow for only sensible values for displays
 *
 ******************************************************************************/
static long get_graphic_double(DBADDR *paddr, struct dbr_grDouble *pgd)
{
    vsRecord *pvs = (vsRecord *)paddr->precord;
    int	fieldIndex = dbGetFieldIndex(paddr);
    
    if (fieldIndex == vsRecordVAL || fieldIndex == vsRecordPRES) {
	pgd->upper_disp_limit = pvs->hopr;
	pgd->lower_disp_limit = pvs->lopr;
    } else if (fieldIndex == vsRecordCGAP) {
	pgd->upper_disp_limit = pvs->hapr;
	pgd->lower_disp_limit = pvs->lapr;
    } else if (fieldIndex == vsRecordCGBP) {
	pgd->upper_disp_limit = pvs->hbpr;
	pgd->lower_disp_limit = pvs->lbpr;
    } else if (fieldIndex == vsRecordLPRS) {
	pgd->upper_disp_limit = pvs->hlpr;
	pgd->lower_disp_limit = pvs->llpr;
    } else if (fieldIndex == vsRecordLCAP) {
	pgd->upper_disp_limit = pvs->halr;
	pgd->lower_disp_limit = pvs->lalr;
    } else if (fieldIndex == vsRecordLCBP) {
	pgd->upper_disp_limit = pvs->hblr;
	pgd->lower_disp_limit = pvs->lblr;
    } else
	recGblGetGraphicDouble(paddr, pgd);
    return (0);
}
Пример #8
0
static long get_graphic_double(DBADDR *paddr, struct dbr_grDouble *pgd)
{
    subRecord *prec = (subRecord *)paddr->precord;
    int fieldIndex = dbGetFieldIndex(paddr);
    int linkNumber;
    
    switch (fieldIndex) {
        case indexof(VAL):
        case indexof(HIHI):
        case indexof(HIGH):
        case indexof(LOW):
        case indexof(LOLO):
        case indexof(LALM):
        case indexof(ALST):
        case indexof(MLST):
            pgd->lower_disp_limit = prec->lopr;
            pgd->upper_disp_limit = prec->hopr;
            break;
        default:
            linkNumber = get_linkNumber(fieldIndex);
            if (linkNumber >= 0) {
                dbGetGraphicLimits(&prec->inpa + linkNumber,
                    &pgd->lower_disp_limit,
                    &pgd->upper_disp_limit);
            } else
                recGblGetGraphicDouble(paddr,pgd);
    }
    return 0;
}
Пример #9
0
static long get_precision(DBADDR *paddr, long *pprecision)
{
    calcoutRecord *prec = (calcoutRecord *)paddr->precord;
    int fieldIndex = dbGetFieldIndex(paddr);
    int linkNumber;

    if (fieldIndex == indexof(ODLY)) {
        *pprecision = calcoutODLYprecision;
        return 0;
    }

    *pprecision = prec->prec;
    if (fieldIndex == indexof(VAL))
        return 0;

    linkNumber = get_linkNumber(fieldIndex);
    if (linkNumber >= 0) {
        short precision;

        if (dbGetPrecision(&prec->inpa + linkNumber, &precision) == 0)
            *pprecision = precision;
    } else
        recGblGetPrec(paddr, pprecision);
    return 0;
}
Пример #10
0
static long get_control_double(DBADDR *paddr, struct dbr_ctrlDouble *pcd)
{
    calcoutRecord *prec = (calcoutRecord *)paddr->precord;
    
    switch (dbGetFieldIndex(paddr)) {
        case indexof(VAL):
        case indexof(HIHI):
        case indexof(HIGH):
        case indexof(LOW):
        case indexof(LOLO):
        case indexof(LALM):
        case indexof(ALST):
        case indexof(MLST):
            pcd->lower_ctrl_limit = prec->lopr;
            pcd->upper_ctrl_limit = prec->hopr;
            break;
        case indexof(ODLY):
            pcd->lower_ctrl_limit = 0.0;
            pcd->upper_ctrl_limit = calcoutODLYlimit;
            break;
        default:
            recGblGetControlDouble(paddr,pcd);
    }
    return 0;
}
Пример #11
0
static long cvt_dbaddr(DBADDR *paddr)
{
    aSubRecord *prec = (aSubRecord *)paddr->precord;
    int fieldIndex = dbGetFieldIndex(paddr);

    if (fieldIndex >= aSubRecordA &&
        fieldIndex <= aSubRecordU) {
        int offset = fieldIndex - aSubRecordA;

        paddr->pfield      = (&prec->a  )[offset];
        paddr->no_elements = (&prec->noa)[offset];
        paddr->field_type  = (&prec->fta)[offset];
    }
    else if (fieldIndex >= aSubRecordVALA &&
             fieldIndex <= aSubRecordVALU) {
        int offset = fieldIndex - aSubRecordVALA;

        paddr->pfield      = (&prec->vala)[offset];
        paddr->no_elements = (&prec->nova)[offset];
        paddr->field_type  = (&prec->ftva)[offset];
    }
    else {
        errlogPrintf("aSubRecord::cvt_dbaddr called for %s\n",
            prec->name);
        return 0;
    }
    paddr->dbr_field_type = paddr->field_type;
    paddr->field_size     = dbValueSize(paddr->field_type);
    return 0;
}
Пример #12
0
static long get_array_info(struct dbAddr *paddr, long *no_elements, long *offset)
{
	acalcoutRecord	*pcalc = (acalcoutRecord *) paddr->precord;
    int				i, fieldIndex = dbGetFieldIndex(paddr);
	double			**ppd;

	if (aCalcoutRecordDebug >= 20) printf("acalcoutRecord(%s):get_array_info: paddr->pfield = %p\n",
		pcalc->name, (void *)paddr->pfield);

	if ((fieldIndex>=acalcoutRecordAA) && (fieldIndex<=acalcoutRecordLL)) {
		i = fieldIndex-acalcoutRecordAA;
		ppd = &(pcalc->aa);
		if (ppd[i] == NULL) {
			if (aCalcoutRecordDebug) printf("acalcoutRecord(%s):get_array_info: allocating for field %c%c\n",
				pcalc->name, (int)('A'+i), (int)('A'+i));
			ppd[i] = (double *)calloc(pcalc->nelm, sizeof(double));
		}
	}
	if ((fieldIndex==acalcoutRecordAVAL) && (pcalc->aval == NULL)) {
		pcalc->aval = (double *)calloc(pcalc->nelm, sizeof(double));
	}
	if ((fieldIndex==acalcoutRecordOAV) && (pcalc->oav == NULL)) {
		pcalc->oav = (double *)calloc(pcalc->nelm, sizeof(double));
	}
    *no_elements = acalcGetNumElements( pcalc );
    *offset = 0;
    return(0);
}
Пример #13
0
static long cvt_dbaddr(DBADDR *paddr)
{
    lsoRecord *prec = (lsoRecord *) paddr->precord;
    int fieldIndex = dbGetFieldIndex(paddr);

    if (fieldIndex == lsoRecordVAL) {
        paddr->pfield = prec->val;
        paddr->special = SPC_MOD;
    }
    else if (fieldIndex == lsoRecordOVAL) {
        paddr->pfield  = prec->oval;
        paddr->special = SPC_NOMOD;
    }
    else {
        errlogPrintf("lsoRecord::cvt_dbaddr called for %s.%s\n",
            prec->name, paddr->pfldDes->name);
        return -1;
    }

    paddr->no_elements    = 1;
    paddr->field_type     = DBF_STRING;
    paddr->dbr_field_type = DBF_STRING;
    paddr->field_size     = prec->sizv;
    return 0;
}
Пример #14
0
static long get_precision(DBADDR *paddr, long *precision)
{
    if(dbGetFieldIndex(paddr) == indexof(HIGH))
        *precision = boHIGHprecision;
    else
        recGblGetPrec(paddr,precision);
    return(0);
}
Пример #15
0
LOCAL long get_array_info(struct dbAddr *paddr,long *no_elements,long *offset)
{
    ab1771IXRecord *precord;
    recordPvt           *precordPvt;

    precord = (ab1771IXRecord *)paddr->precord;
    precordPvt = (recordPvt *)precord->dpvt;
    if(dbGetFieldIndex(paddr)==ab1771IXRecordINPM) {
	*no_elements = NUM_WORDS_IN;
	*offset = 0;
    } else if(dbGetFieldIndex(paddr)==ab1771IXRecordOUTM) {
	*no_elements = NUM_WORDS_OUT;
	*offset = 0;
    } else {
	errlogPrintf("%s get_array_info for illegal field\n",precord->name);
    }
    return(0);
}
Пример #16
0
static long get_control_double(DBADDR *paddr,struct dbr_ctrlDouble *pcd)
{
    if(dbGetFieldIndex(paddr) == indexof(HIGH)) {
        pcd->lower_ctrl_limit = 0.0;
        pcd->upper_ctrl_limit = boHIGHlimit;
    } else
        recGblGetControlDouble(paddr,pcd);
    return(0);
}
Пример #17
0
static long get_precision(dbAddr *paddr, long *precision)
{
	acalcoutRecord	*pcalc=(acalcoutRecord *)paddr->precord;
	int fieldIndex = dbGetFieldIndex(paddr);

	*precision = pcalc->prec;
	if (fieldIndex == acalcoutRecordVAL) return(0);
	recGblGetPrec(paddr,precision);
	return(0);
}
Пример #18
0
static long get_graphic_double(DBADDR *paddr, struct dbr_grDouble *pgd)
{
    waveformRecord *prec = (waveformRecord *) paddr->precord;

    if (dbGetFieldIndex(paddr) == waveformRecordVAL) {
        pgd->upper_disp_limit = prec->hopr;
        pgd->lower_disp_limit = prec->lopr;
    } else
        recGblGetGraphicDouble(paddr, pgd);
    return 0;
}
Пример #19
0
static long get_precision(DBADDR *paddr, long *precision)
{
    subRecord *prec = (subRecord *)paddr->precord;
    int fieldIndex = dbGetFieldIndex(paddr);

    *precision = prec->prec;
    if (fieldIndex != subRecordVAL)
        recGblGetPrec(paddr, precision);

    return 0;
}
Пример #20
0
static long get_precision(struct dbAddr *paddr, long *precision)
{
    struct epidRecord   *pepid=(struct epidRecord *)paddr->precord;
    int fieldIndex = dbGetFieldIndex(paddr);

    *precision = pepid->prec;
    if (fieldIndex == epidRecordVAL
            ||  fieldIndex == epidRecordCVAL) return(0);
    recGblGetPrec(paddr,precision);
    return(0);
}
Пример #21
0
static long get_control_double(DBADDR *paddr, struct dbr_ctrlDouble *pcd)
{
    waveformRecord *prec = (waveformRecord *) paddr->precord;

    if (dbGetFieldIndex(paddr) == waveformRecordVAL) {
        pcd->upper_ctrl_limit = prec->hopr;
        pcd->lower_ctrl_limit = prec->lopr;
    } else
        recGblGetControlDouble(paddr, pcd);
    return 0;
}
Пример #22
0
static long get_units(DBADDR *paddr, char *units)
{
    calcoutRecord *prec = (calcoutRecord *)paddr->precord;
    int fieldIndex = dbGetFieldIndex(paddr);
    int linkNumber;

    if(fieldIndex == indexof(ODLY)) {
        strcpy(units, "s");
        return 0;
    }

    if(paddr->pfldDes->field_type == DBF_DOUBLE) {
        linkNumber = get_linkNumber(dbGetFieldIndex(paddr));
        if (linkNumber >= 0)
            dbGetUnits(&prec->inpa + linkNumber, units, DB_UNITS_SIZE);
        else
            strncpy(units,prec->egu,DB_UNITS_SIZE);
    }
    return 0;
}
Пример #23
0
static long get_alarm_double(DBADDR *paddr, struct dbr_alDouble *pad)
{
    aoRecord	*prec=(aoRecord *)paddr->precord;

    if(dbGetFieldIndex(paddr) == indexof(VAL)){
        pad->upper_alarm_limit = prec->hhsv ? prec->hihi : epicsNAN;
        pad->upper_warning_limit = prec->hsv ? prec->high : epicsNAN;
        pad->lower_warning_limit = prec->lsv ? prec->low : epicsNAN;
        pad->lower_alarm_limit = prec->llsv ? prec->lolo : epicsNAN;
    } else recGblGetAlarmDouble(paddr,pad);
    return(0);
}
Пример #24
0
static long get_alarm_double(DBADDR *paddr,struct dbr_alDouble *pad)
{
    longoutRecord    *prec=(longoutRecord *)paddr->precord;

    if(dbGetFieldIndex(paddr) == indexof(VAL)) {
         pad->upper_alarm_limit = prec->hihi;
         pad->upper_warning_limit = prec->high;
         pad->lower_warning_limit = prec->low;
         pad->lower_alarm_limit = prec->lolo;
    } else recGblGetAlarmDouble(paddr,pad);
    return(0);
}
Пример #25
0
static long put_array_info(struct dbAddr *paddr, long nNew)
{
	acalcoutRecord	*pcalc = (acalcoutRecord *) paddr->precord;
	double			**ppd, *pd = NULL;
	long			i;
	long			numElements;
    int				fieldIndex = dbGetFieldIndex(paddr);

	if (aCalcoutRecordDebug >= 20) {
		printf("acalcoutRecord(%s):put_array_info: paddr->pfield = %p, pcalc->aa=%p, nNew=%ld\n",
			pcalc->name, (void *)paddr->pfield, (void *)pcalc->aa, nNew);
	}

	if ((fieldIndex>=acalcoutRecordAA) && (fieldIndex<=acalcoutRecordLL)) {
		i = fieldIndex-acalcoutRecordAA;
		ppd = &(pcalc->aa);
		if (ppd[i] == NULL) {
			if (aCalcoutRecordDebug) printf("acalcoutRecord(%s):put_array_info: allocating for field %c%c\n",
				pcalc->name, (int)('A'+i), (int)('A'+i));
			ppd[i] = (double *)calloc(pcalc->nelm, sizeof(double));
		}
		pd = ppd[i];
	} else if (fieldIndex==acalcoutRecordAVAL) {
		if (pcalc->aval == NULL) pcalc->aval = (double *)calloc(pcalc->nelm, sizeof(double));
		pd = pcalc->aval;
	} else if (fieldIndex==acalcoutRecordOAV) {
		if (pcalc->oav == NULL) pcalc->oav = (double *)calloc(pcalc->nelm, sizeof(double));
		pd = pcalc->oav;
	}

	if (aCalcoutRecordDebug >= 20) {
		printf("acalcoutRecord(%s):put_array_info: pd=%p\n", pcalc->name, (void *)pd);
	}

#if MIND_UNUSED_ELEMENTS
	numElements = pcalc->nelm;
#else
	numElements = acalcGetNumElements( pcalc );
#endif
	if ( pd && (nNew < numElements) )
		for (i=nNew; i<numElements; i++)
			pd[i] = 0.;

	/* We could set nuse to the number of elements just written, but that would also
	 * affect the other arrays.  For now, with all arrays sharing a single value of nuse,
	 * it seems better to require that nuse be set explicitly.  Currently, I'm leaving
	 * unanswered the question of whether each array should have its own 'nuse'.  The
	 * array-calc engine currently doesn't support per-array 'nuse'.
	 */

    return(0);
}
Пример #26
0
static long get_alarm_double(DBADDR *paddr,struct dbr_alDouble *pad)
{
    rdbpostgreSQLRecord	*prec=(rdbpostgreSQLRecord *)paddr->precord;
    int		fieldIndex = dbGetFieldIndex(paddr);

    if(fieldIndex == rdbpostgreSQLRecordVAL) {
        pad->upper_alarm_limit = prec->hhsv ? prec->hihi : epicsNAN;
        pad->upper_warning_limit = prec->hsv ? prec->high : epicsNAN;
        pad->lower_warning_limit = prec->lsv ? prec->low : epicsNAN;
        pad->lower_alarm_limit = prec->llsv ? prec->lolo : epicsNAN;
    } else recGblGetAlarmDouble(paddr,pad);
    return(0);
}
Пример #27
0
static long get_alarm_double(struct dbAddr *paddr, struct dbr_alDouble *pad)
{
    struct epidRecord   *pepid=(struct epidRecord *)paddr->precord;
    int fieldIndex = dbGetFieldIndex(paddr);

    if(fieldIndex == epidRecordVAL) {
        pad->upper_alarm_limit = pepid->hihi;
        pad->upper_warning_limit = pepid->high;
        pad->lower_warning_limit = pepid->low;
        pad->lower_alarm_limit = pepid->lolo;
    } else recGblGetAlarmDouble(paddr,pad);
    return(0);
}
Пример #28
0
static long get_alarm_double(DBADDR *paddr,struct dbr_alDouble *pad)
{
    ushortRecord	*pushort=(ushortRecord *)paddr->precord;
    int		fieldIndex = dbGetFieldIndex(paddr);

    if(fieldIndex == ushortRecordVAL) {
	pad->upper_alarm_limit = pushort->hihi;
	pad->upper_warning_limit = pushort->high;
	pad->lower_warning_limit = pushort->low;
	pad->lower_alarm_limit = pushort->lolo;
    } else recGblGetAlarmDouble(paddr,pad);
    return(0);
}
Пример #29
0
/*****************************************************************************
*
* Allow for only sensible values for entries
*
******************************************************************************/
static long get_control_double(DBADDR *paddr, struct dbr_ctrlDouble * pcd)
{
    vsRecord *pvs = (vsRecord *)paddr->precord;
    int	fieldIndex = dbGetFieldIndex(paddr);
    
    if (fieldIndex == vsRecordVAL || fieldIndex == vsRecordPRES
      || fieldIndex == vsRecordCGAP
      || fieldIndex == vsRecordCGBP) {
	pcd->upper_ctrl_limit = pvs->hopr;
	pcd->lower_ctrl_limit = pvs->lopr;
    } else
        recGblGetControlDouble(paddr, pcd);
    return (0);
}
Пример #30
0
static long get_precision(struct dbAddr *paddr, long *precision)
{
    struct cvtRecord *pcvt = (struct cvtRecord *)paddr->precord;
    int fieldIndex = dbGetFieldIndex(paddr);

    switch (fieldIndex) {
    case cvtRecordVAL:
        *precision = pcvt->prec;
        break;
    default:
        recGblGetPrec(paddr, precision);
    }
    return 0;
}