static long writeData (dbCommon *record, format_t *format) { longoutRecord *lo = (longoutRecord *) record; switch (format->type) { case DBF_ULONG: case DBF_ENUM: return streamPrintf (record, format, (unsigned long)lo->val); case DBF_LONG: return streamPrintf (record, format, (long)lo->val); } return ERROR; }
static long writeData(dbCommon *record, format_t *format) { lsiRecord *lsi = (lsiRecord *)record; if (format->type != DBF_STRING) return ERROR; return streamPrintf(record, format, lsi->val); }
static long writeData (dbCommon *record, format_t *format) { calcoutRecord *co = (calcoutRecord *) record; switch (format->type) { case DBF_DOUBLE: { return streamPrintf (record, format, co->oval); } case DBF_LONG: case DBF_ENUM: { return streamPrintf (record, format, (long)co->oval); } } return ERROR; }
static long writeData (dbCommon *record, format_t *format) { stringinRecord *si = (stringinRecord *) record; if (format->type == DBF_STRING) { return streamPrintf (record, format, si->val); } return ERROR; }
static long writeData (dbCommon *record, format_t *format) { aiRecord *ai = (aiRecord *) record; double val; switch (format->type) { case DBF_DOUBLE: { val = ai->val - ai->aoff; if (ai->aslo != 0) val /= ai->aslo; return streamPrintf (record, format, val); } case DBF_LONG: { return streamPrintf (record, format, (long) ai->rval); } } return ERROR; }
static long writeData (dbCommon *record, format_t *format) { biRecord *bi = (biRecord *) record; switch (format->type) { case DBF_LONG: { return streamPrintf (record, format, bi->rval); } case DBF_ENUM: { return streamPrintf (record, format, (long) bi->val); } case DBF_STRING: { return streamPrintf (record, format, bi->val ? bi->onam : bi->znam); } } return ERROR; }
static long writeData (dbCommon *record, format_t *format) { mbboDirectRecord *mbboD = (mbboDirectRecord *) record; long val; if (format->type == DBF_LONG) { if (mbboD->mask) val = mbboD->rval & mbboD->mask; else val = mbboD->val; return streamPrintf (record, format, val); } return ERROR; }
static long writeData (dbCommon *record, format_t *format) { mbboRecord *mbbo = (mbboRecord *) record; long val; int i; switch (format->type) { case DBF_LONG: { /* print VAL or RVAL ? */ val = mbbo->val; if (mbbo->sdef) for (i=0; i<16; i++) { if ((&mbbo->zrvl)[i]) { /* any values defined ? */ val = mbbo->rval; if (mbbo->mask) val &= mbbo->mask; break; } } return streamPrintf (record, format, val); } case DBF_ENUM: { return streamPrintf (record, format, (long) mbbo->val); } case DBF_STRING: { if (mbbo->val >= 16) return ERROR; return streamPrintf (record, format, mbbo->zrst + sizeof(mbbo->zrst) * mbbo->val); } } return ERROR; }
static long writeData (dbCommon *record, format_t *format) { waveformRecord *wf = (waveformRecord *) record; double dval; long lval; unsigned long nowd; for (nowd = 0; nowd < wf->nord; nowd++) { switch (format->type) { case DBF_DOUBLE: { switch (wf->ftvl) { case DBF_DOUBLE: dval = ((epicsFloat64 *)wf->bptr)[nowd]; break; case DBF_FLOAT: dval = ((epicsFloat32 *)wf->bptr)[nowd]; break; case DBF_LONG: dval = ((epicsInt32 *)wf->bptr)[nowd]; break; case DBF_ULONG: dval = ((epicsUInt32 *)wf->bptr)[nowd]; break; case DBF_SHORT: dval = ((epicsInt16 *)wf->bptr)[nowd]; break; case DBF_USHORT: case DBF_ENUM: dval = ((epicsUInt16 *)wf->bptr)[nowd]; break; case DBF_CHAR: dval = ((epicsInt8 *)wf->bptr)[nowd]; break; case DBF_UCHAR: dval = ((epicsUInt8 *)wf->bptr)[nowd]; break; default: errlogSevPrintf (errlogFatal, "writeData %s: can't convert from %s to double\n", record->name, pamapdbfType[wf->ftvl].strvalue); return ERROR; } if (streamPrintf (record, format, dval)) return ERROR; break; } case DBF_LONG: case DBF_ENUM: { switch (wf->ftvl) { case DBF_LONG: lval = ((epicsInt32 *)wf->bptr)[nowd]; break; case DBF_ULONG: lval = ((epicsUInt32 *)wf->bptr)[nowd]; break; case DBF_SHORT: lval = ((epicsInt16 *)wf->bptr)[nowd]; break; case DBF_USHORT: case DBF_ENUM: lval = ((epicsUInt16 *)wf->bptr)[nowd]; break; case DBF_CHAR: lval = ((epicsInt8 *)wf->bptr)[nowd]; break; case DBF_UCHAR: lval = ((epicsUInt8 *)wf->bptr)[nowd]; break; default: errlogSevPrintf (errlogFatal, "writeData %s: can't convert from %s to long\n", record->name, pamapdbfType[wf->ftvl].strvalue); return ERROR; } if (streamPrintf (record, format, lval)) return ERROR; break; } case DBF_STRING: { switch (wf->ftvl) { case DBF_STRING: if (streamPrintf (record, format, ((char *)wf->bptr) + nowd * MAX_STRING_SIZE)) return ERROR; break; case DBF_CHAR: case DBF_UCHAR: /* print waveform as a null-terminated string */ if (wf->nord < wf->nelm) { ((char *)wf->bptr)[wf->nord] = 0; } else { ((char *)wf->bptr)[wf->nelm-1] = 0; } if (streamPrintf (record, format, ((char *)wf->bptr))) return ERROR; return OK; default: errlogSevPrintf (errlogFatal, "writeData %s: can't convert from %s to string\n", record->name, pamapdbfType[wf->ftvl].strvalue); return ERROR; } break; } default: { errlogSevPrintf (errlogFatal, "writeData %s: can't convert from %s to %s\n", record->name, pamapdbfType[wf->ftvl].strvalue, pamapdbfType[format->type].strvalue); return ERROR; } } } return OK; }