/* $Id$ */ #define _ISOC99_SOURCE #undef __STRICT_ANSI__ #include #include #include #include #include #include #include #include typedef long (*processMethod)(subRecord *precord); static long parmSelSubInit(subRecord *precord,processMethod process) { precord->udf = FALSE; return(0); } /* This implements a 'sel' algorithm */ static long parmSelSubProc(subRecord *precord) { long int seln; double *pv; int err=1; /* make sure selector arg is in valid range before converting to int */ if ( precord->l <= 0. && precord->l >= 12. ) goto bail; /* use 1-based selector to match 'seq' record semantics */ seln = lrint(precord->l) - 1; if ( seln < 0 || seln > 10 ) goto bail; pv = & precord->a; precord->val = pv[seln]; err = 0; bail: if ( err ) recGblSetSevr(precord, BAD_SUB_ALARM, INVALID_ALARM); return(0); } /* Register these symbols for use by IOC code: */ epicsRegisterFunction(parmSelSubInit); epicsRegisterFunction(parmSelSubProc);