Argonne National Laboratory

Experimental Physics and
Industrial Control System

2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <2017 Index 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <2017
<== Date ==> <== Thread ==>

Subject: Patch file for Records which use consistent epics data types
From: Jeong Han Lee <citadel.lee@gmail.com>
To: core-talk@aps.anl.gov
Date: Fri, 28 Apr 2017 01:38:30 +0200
Hi,

   I did modify the records, which I mentioned in tech-talks as below:
   http://www.aps.anl.gov/epics/tech-talk/2017/msg00690.php

   Main focus are the following three items
   1. recGblResetAlarms returns unsigned short / epicsUInt16
   2. recGblCheckDeadband uses "unsigned (int) / epicsUInt32
   3. db_post_events uses "unsigned int / epicsUInt32

   So, I decided to minimize any changes on the monitor functions.

   Please let me know what you think.

   Thanks,
   Han


diff --git src/std/rec/aSubRecord.c src/std/rec/aSubRecord.c
index 727c369..451dc62 100644
--- src/std/rec/aSubRecord.c
+++ src/std/rec/aSubRecord.c
@@ -441,10 +441,8 @@ static long get_alarm_double(DBADDR *paddr, struct dbr_alDouble *pad)
 
 static void monitor(aSubRecord *prec)
 {
-    int            i;
-    unsigned short monitor_mask;
-
-    monitor_mask = recGblResetAlarms(prec) | DBE_VALUE | DBE_LOG;
+    epicsUInt32 monitor_mask = (epicsUInt32) recGblResetAlarms(prec) | DBE_VALUE | DBE_LOG;
+    epicsInt32  i = 0;
 
     /* Post events for VAL field */
     if (prec->val != prec->oval) {
diff --git src/std/rec/aaiRecord.c src/std/rec/aaiRecord.c
index 43cb73b..0723bcc 100644
--- src/std/rec/aaiRecord.c
+++ src/std/rec/aaiRecord.c
@@ -280,10 +280,8 @@ static long get_control_double(DBADDR *paddr, struct dbr_ctrlDouble *pcd)
 
 static void monitor(aaiRecord *prec)
 {
-    unsigned short monitor_mask;
-    unsigned int hash = 0;
-
-    monitor_mask = recGblResetAlarms(prec);
+    epicsUInt32 monitor_mask = (epicsUInt32) recGblResetAlarms(prec);
+    epicsUInt32 hash = 0;
 
     if (prec->mpst == aaiPOST_Always)
         monitor_mask |= DBE_VALUE;
diff --git src/std/rec/aaoRecord.c src/std/rec/aaoRecord.c
index 853b92c..f39989c 100644
--- src/std/rec/aaoRecord.c
+++ src/std/rec/aaoRecord.c
@@ -280,10 +280,8 @@ static long get_control_double(DBADDR *paddr, struct dbr_ctrlDouble *pcd)
 
 static void monitor(aaoRecord *prec)
 {
-    unsigned short monitor_mask;
-    unsigned int hash = 0;
-
-    monitor_mask = recGblResetAlarms(prec);
+    epicsUInt32 monitor_mask = (epicsUInt32) recGblResetAlarms(prec);
+    epicsUInt32 hash = 0;
 
     if (prec->mpst == aaoPOST_Always)
         monitor_mask |= DBE_VALUE;
diff --git src/std/rec/aiRecord.c src/std/rec/aiRecord.c
index 31ce25a..389053c 100644
--- src/std/rec/aiRecord.c
+++ src/std/rec/aiRecord.c
@@ -455,7 +455,7 @@ static void convert(aiRecord *prec)
 
 static void monitor(aiRecord *prec)
 {
-    unsigned monitor_mask = recGblResetAlarms(prec);
+    epicsUInt32 monitor_mask = (epicsUInt32) recGblResetAlarms(prec);
 
     /* check for value change */
     recGblCheckDeadband(&prec->mlst, prec->val, prec->mdel, &monitor_mask, DBE_VALUE);
diff --git src/std/rec/aoRecord.c src/std/rec/aoRecord.c
index 3851de9..9a85a23 100644
--- src/std/rec/aoRecord.c
+++ src/std/rec/aoRecord.c
@@ -518,7 +518,7 @@ static void convert(aoRecord *prec, double value)
 
 static void monitor(aoRecord *prec)
 {
-    unsigned monitor_mask = recGblResetAlarms(prec);
+    epicsUInt32 monitor_mask = (epicsUInt32) recGblResetAlarms(prec);
 
     /* check for value change */
     recGblCheckDeadband(&prec->mlst, prec->val, prec->mdel, &monitor_mask, DBE_VALUE);
diff --git src/std/rec/biRecord.c src/std/rec/biRecord.c
index 7afea3d..c825275 100644
--- src/std/rec/biRecord.c
+++ src/std/rec/biRecord.c
@@ -227,9 +227,7 @@ static void checkAlarms(biRecord *prec)
 
 static void monitor(biRecord *prec)
 {
-	unsigned short	monitor_mask;
-
-        monitor_mask = recGblResetAlarms(prec);
+        epicsUInt32 monitor_mask = (epicsUInt32) recGblResetAlarms(prec);
         /* check for value change */
         if (prec->mlst != prec->val){
                 /* post events for value change and archive change */
diff --git src/std/rec/boRecord.c src/std/rec/boRecord.c
index 537362c..26ed582 100644
--- src/std/rec/boRecord.c
+++ src/std/rec/boRecord.c
@@ -373,9 +373,8 @@ static void checkAlarms(boRecord *prec)
 
 static void monitor(boRecord *prec)
 {
-	unsigned short	monitor_mask;
-
-        monitor_mask = recGblResetAlarms(prec);
+        epicsUInt32 monitor_mask = (epicsUInt32) recGblResetAlarms(prec);
+	
         /* check for value change */
         if (prec->mlst != prec->val){
                 /* post events for value change and archive change */
diff --git src/std/rec/calcRecord.c src/std/rec/calcRecord.c
index 9c4e023..e965b95 100644
--- src/std/rec/calcRecord.c
+++ src/std/rec/calcRecord.c
@@ -395,12 +395,11 @@ static void checkAlarms(calcRecord *prec, epicsTimeStamp *timeLast)
 
 static void monitor(calcRecord *prec)
 {
-    unsigned monitor_mask;
-    double *pnew, *pprev;
-    int i;
-
-    monitor_mask = recGblResetAlarms(prec);
-
+    epicsUInt32  monitor_mask = (epicsUInt32) recGblResetAlarms(prec);
+    epicsFloat64 *pnew;
+    epicsFloat64 *pprev;
+    epicsInt32   i = 0;
+    
     /* check for value change */
     recGblCheckDeadband(&prec->mlst, prec->val, prec->mdel, &monitor_mask, DBE_VALUE);
 
diff --git src/std/rec/calcoutRecord.c src/std/rec/calcoutRecord.c
index da6cf42..aaaca75 100644
--- src/std/rec/calcoutRecord.c
+++ src/std/rec/calcoutRecord.c
@@ -624,12 +624,10 @@ static void execOutput(calcoutRecord *prec)
 
 static void monitor(calcoutRecord *prec)
 {
-    unsigned        monitor_mask;
-    double          *pnew;
-    double          *pprev;
-    int             i;
-
-    monitor_mask = recGblResetAlarms(prec);
+    epicsUInt32     monitor_mask = (epicsUInt32) recGblResetAlarms(prec);
+    epicsFloat64    *pnew;
+    epicsFloat64    *pprev;
+    epicsInt32      i = 0;
 
     /* check for value change */
     recGblCheckDeadband(&prec->mlst, prec->val, prec->mdel, &monitor_mask, DBE_VALUE);
diff --git src/std/rec/compressRecord.c src/std/rec/compressRecord.c
index 4b4de5f..5186bf9 100644
--- src/std/rec/compressRecord.c
+++ src/std/rec/compressRecord.c
@@ -98,8 +98,8 @@ static void reset(compressRecord *prec)
 
 static void monitor(compressRecord *prec)
 {
-    unsigned short alarm_mask = recGblResetAlarms(prec);
-    unsigned short monitor_mask = alarm_mask | DBE_LOG | DBE_VALUE;
+    epicsUInt16 alarm_mask = recGblResetAlarms(prec);
+    epicsUInt32 monitor_mask = (epicsUInt32) alarm_mask | DBE_LOG | DBE_VALUE;
 
     if (alarm_mask || prec->nuse != prec->ouse) {
         db_post_events(prec, &prec->nuse, monitor_mask);
diff --git src/std/rec/dfanoutRecord.c src/std/rec/dfanoutRecord.c
index 76ee31b..07fd6a8 100644
--- src/std/rec/dfanoutRecord.c
+++ src/std/rec/dfanoutRecord.c
@@ -259,7 +259,7 @@ static void checkAlarms(dfanoutRecord *prec)
 
 static void monitor(dfanoutRecord *prec)
 {
-    unsigned monitor_mask = recGblResetAlarms(prec);
+    epicsUInt32 monitor_mask = (epicsUInt32) recGblResetAlarms(prec);
 
     /* check for value change */
     recGblCheckDeadband(&prec->mlst, prec->val, prec->mdel, &monitor_mask, DBE_VALUE);
diff --git src/std/rec/eventRecord.c src/std/rec/eventRecord.c
index 602023a..6171ad0 100644
--- src/std/rec/eventRecord.c
+++ src/std/rec/eventRecord.c
@@ -156,10 +156,8 @@ static long special(DBADDR *paddr, int after)
 
 static void monitor(eventRecord *prec)
 {
-    unsigned short  monitor_mask;
-
+    epicsUInt32 monitor_mask = (epicsUInt32) recGblResetAlarms(prec);
     /* get previous stat and sevr  and new stat and sevr*/
-    monitor_mask = recGblResetAlarms(prec);
     db_post_events(prec,&prec->val,monitor_mask|DBE_VALUE);
     return;
 }
diff --git src/std/rec/histogramRecord.c src/std/rec/histogramRecord.c
index 84010ee..d2cda8d 100644
--- src/std/rec/histogramRecord.c
+++ src/std/rec/histogramRecord.c
@@ -293,8 +293,8 @@ static long special(DBADDR *paddr, int after)
 
 static void monitor(histogramRecord *prec)
 {
-    unsigned short monitor_mask = recGblResetAlarms(prec);
-
+    epicsUInt32 monitor_mask = (epicsUInt32) recGblResetAlarms(prec);
+    
     /* post events for count change */
     if (prec->mcnt > prec->mdel){
         monitor_mask |= DBE_VALUE | DBE_LOG;
diff --git src/std/rec/longinRecord.c src/std/rec/longinRecord.c
index dc7eb1b..6cc6951 100644
--- src/std/rec/longinRecord.c
+++ src/std/rec/longinRecord.c
@@ -356,7 +356,7 @@ static void checkAlarms(longinRecord *prec, epicsTimeStamp *timeLast)
 
 static void monitor(longinRecord *prec)
 {
-    unsigned short monitor_mask = recGblResetAlarms(prec);
+    epicsUInt32 monitor_mask = (epicsUInt32) recGblResetAlarms(prec);
 
     if (prec->mdel < 0 ||
         DELTA(prec->mlst, prec->val) > (epicsUInt32) prec->mdel) {
diff --git src/std/rec/longoutRecord.c src/std/rec/longoutRecord.c
index 8a9c1cf..6390770 100644
--- src/std/rec/longoutRecord.c
+++ src/std/rec/longoutRecord.c
@@ -329,7 +329,7 @@ static void checkAlarms(longoutRecord *prec)
 
 static void monitor(longoutRecord *prec)
 {
-    unsigned short monitor_mask = recGblResetAlarms(prec);
+    epicsUInt32 monitor_mask = (epicsUInt32) recGblResetAlarms(prec);
 
     if (prec->mdel < 0 ||
         DELTA(prec->mlst, prec->val) > (epicsUInt32) prec->mdel) {
diff --git src/std/rec/lsiRecord.c src/std/rec/lsiRecord.c
index 81b6785..75cb655 100644
--- src/std/rec/lsiRecord.c
+++ src/std/rec/lsiRecord.c
@@ -187,7 +187,7 @@ static long special(DBADDR *paddr, int after)
 
 static void monitor(lsiRecord *prec)
 {
-    epicsUInt16 events = recGblResetAlarms(prec);
+    epicsUInt32 events = (epicsUInt32) recGblResetAlarms(prec);
 
     if (prec->len != prec->olen ||
         memcmp(prec->oval, prec->val, prec->len)) {
diff --git src/std/rec/lsoRecord.c src/std/rec/lsoRecord.c
index 625f5d7..2a766fa 100644
--- src/std/rec/lsoRecord.c
+++ src/std/rec/lsoRecord.c
@@ -229,8 +229,8 @@ static long special(DBADDR *paddr, int after)
 
 static void monitor(lsoRecord *prec)
 {
-    epicsUInt16 events = recGblResetAlarms(prec);
-
+    epicsUInt32 events = (epicsUInt32) recGblResetAlarms(prec);
+    
     if (prec->len != prec->olen ||
         memcmp(prec->oval, prec->val, prec->len)) {
         events |= DBE_VALUE | DBE_LOG;
diff --git src/std/rec/mbbiDirectRecord.c src/std/rec/mbbiDirectRecord.c
index 3d1b3f8..93d9720 100644
--- src/std/rec/mbbiDirectRecord.c
+++ src/std/rec/mbbiDirectRecord.c
@@ -189,11 +189,11 @@ static long process(struct dbCommon *pcommon)
 
 static void monitor(mbbiDirectRecord *prec)
 {
-    epicsUInt16 events = recGblResetAlarms(prec);
-    epicsUInt16 vl_events = events | DBE_VALUE | DBE_LOG;
+    epicsUInt32 events = (epicsUInt32) recGblResetAlarms(prec);
+    epicsUInt32 vl_events = events | DBE_VALUE | DBE_LOG;
     epicsUInt16 val = prec->val;
     epicsUInt8 *pBn = &prec->b0;
-    int i;
+    epicsInt32 i = 0;
 
     /* Update B0 - BF from VAL and post monitors */
     for (i = 0; i < NUM_BITS; i++, pBn++, val >>= 1) {
diff --git src/std/rec/mbbiRecord.c src/std/rec/mbbiRecord.c
index 72000f4..7245227 100644
--- src/std/rec/mbbiRecord.c
+++ src/std/rec/mbbiRecord.c
@@ -356,7 +356,7 @@ static void checkAlarms(mbbiRecord *prec, epicsTimeStamp *timeLast)
 
 static void monitor(mbbiRecord *prec)
 {
-    epicsUInt16 events = recGblResetAlarms(prec);
+    epicsUInt32 events = (epicsUInt32) recGblResetAlarms(prec);
 
     if (prec->mlst != prec->val) {
         events |= DBE_VALUE | DBE_LOG;
diff --git src/std/rec/mbboDirectRecord.c src/std/rec/mbboDirectRecord.c
index b807a98..3dfe866 100644
--- src/std/rec/mbboDirectRecord.c
+++ src/std/rec/mbboDirectRecord.c
@@ -307,7 +307,7 @@ static long special(DBADDR *paddr, int after)
 
 static void monitor(mbboDirectRecord *prec)
 {
-    epicsUInt16 events = recGblResetAlarms(prec);
+    epicsUInt32 events = (epicsUInt32) recGblResetAlarms(prec);
 
     if (prec->mlst != prec->val) {
         events |= DBE_VALUE | DBE_LOG;
diff --git src/std/rec/mbboRecord.c src/std/rec/mbboRecord.c
index c3e89a1..c854fdd 100644
--- src/std/rec/mbboRecord.c
+++ src/std/rec/mbboRecord.c
@@ -389,8 +389,8 @@ static void checkAlarms(mbboRecord *prec)
 
 static void monitor(mbboRecord *prec)
 {
-    epicsUInt16 events = recGblResetAlarms(prec);
-
+    epicsUInt32 events = (epicsUInt32) recGblResetAlarms(prec);
+    
     if (prec->mlst != prec->val) {
         events |= DBE_VALUE | DBE_LOG;
         prec->mlst = prec->val;
diff --git src/std/rec/permissiveRecord.c src/std/rec/permissiveRecord.c
index e553931..8bd1928 100644
--- src/std/rec/permissiveRecord.c
+++ src/std/rec/permissiveRecord.c
@@ -91,10 +91,12 @@ static long process(struct dbCommon *pcommon)
 
 static void monitor(permissiveRecord *prec)
 {
-    unsigned short  monitor_mask;
-    unsigned short  val,oval,wflg,oflg;
+    epicsUInt32 monitor_mask = (epicsUInt32) recGblResetAlarms(prec);
+    epicsUInt16 val  = 0;
+    epicsUInt16 oval = 0;
+    epicsUInt16 wflg = 0;
+    epicsUInt16 oflg = 0;
 
-    monitor_mask = recGblResetAlarms(prec);
     /* get val,oval,wflg,oflg*/
     val=prec->val;
     oval=prec->oval;
diff --git src/std/rec/selRecord.c src/std/rec/selRecord.c
index de5e017..7ea7c5d 100644
--- src/std/rec/selRecord.c
+++ src/std/rec/selRecord.c
@@ -307,12 +307,10 @@ static void checkAlarms(selRecord *prec)
 
 static void monitor(selRecord *prec)
 {
-    unsigned    monitor_mask;
-    double		*pnew;
-    double		*pprev;
-    int			i;
-
-    monitor_mask = recGblResetAlarms(prec);
+    epicsUInt32   monitor_mask = (epicsUInt32) recGblResetAlarms(prec);
+    epicsFloat64  *pnew;
+    epicsFloat64  *pprev;
+    epicsInt32    i = 0;
 
     /* check for value change */
     recGblCheckDeadband(&prec->mlst, prec->val, prec->mdel, &monitor_mask, DBE_VALUE);
diff --git src/std/rec/stateRecord.c src/std/rec/stateRecord.c
index ca5df02..6093d49 100644
--- src/std/rec/stateRecord.c
+++ src/std/rec/stateRecord.c
@@ -93,10 +93,8 @@ static long process(struct dbCommon *pcommon)
 
 static void monitor(stateRecord *prec)
 {
-    unsigned short  monitor_mask;
-
+    epicsUInt32 monitor_mask = (epicsUInt32) recGblResetAlarms(prec);
     /* get previous stat and sevr  and new stat and sevr*/
-    monitor_mask = recGblResetAlarms(prec);
     if(strncmp(prec->oval,prec->val,sizeof(prec->val))) {
         db_post_events(prec,&(prec->val[0]),monitor_mask|DBE_VALUE|DBE_LOG);
 	strncpy(prec->oval,prec->val,sizeof(prec->val));
diff --git src/std/rec/stringinRecord.c src/std/rec/stringinRecord.c
index 28d4aae..5646e0b 100644
--- src/std/rec/stringinRecord.c
+++ src/std/rec/stringinRecord.c
@@ -157,8 +157,8 @@ static long process(struct dbCommon *pcommon)
 
 static void monitor(stringinRecord *prec)
 {
-    int monitor_mask = recGblResetAlarms(prec);
-
+    epicsUInt32 monitor_mask = (epicsUInt32) recGblResetAlarms(prec);
+    
     if (strncmp(prec->oval, prec->val, sizeof(prec->val))) {
         monitor_mask |= DBE_VALUE | DBE_LOG;
         strncpy(prec->oval, prec->val, sizeof(prec->val));
diff --git src/std/rec/stringoutRecord.c src/std/rec/stringoutRecord.c
index 7ea2c4c..aec7bdc 100644
--- src/std/rec/stringoutRecord.c
+++ src/std/rec/stringoutRecord.c
@@ -185,8 +185,8 @@ static long process(struct dbCommon *pcommon)
 
 static void monitor(stringoutRecord *prec)
 {
-    int monitor_mask = recGblResetAlarms(prec);
-
+    epicsUInt32 monitor_mask = (epicsUInt32) recGblResetAlarms(prec);
+    
     if (strncmp(prec->oval, prec->val, sizeof(prec->val))) {
         monitor_mask |= DBE_VALUE | DBE_LOG;
         strncpy(prec->oval, prec->val, sizeof(prec->val));
diff --git src/std/rec/subArrayRecord.c src/std/rec/subArrayRecord.c
index 3de610c..c87c935 100644
--- src/std/rec/subArrayRecord.c
+++ src/std/rec/subArrayRecord.c
@@ -291,9 +291,7 @@ static long get_control_double(DBADDR *paddr, struct dbr_ctrlDouble *pcd)
 
 static void monitor(subArrayRecord *prec)
 {
-    unsigned short monitor_mask;
-
-    monitor_mask = recGblResetAlarms(prec);
+    epicsUInt32 monitor_mask = (epicsUInt32) recGblResetAlarms(prec);
     monitor_mask |= (DBE_LOG|DBE_VALUE);
 
     db_post_events(prec, prec->bptr, monitor_mask);
diff --git src/std/rec/subRecord.c src/std/rec/subRecord.c
index f440eca..68901fe 100644
--- src/std/rec/subRecord.c
+++ src/std/rec/subRecord.c
@@ -372,13 +372,12 @@ static void checkAlarms(subRecord *prec)
 
 static void monitor(subRecord *prec)
 {
-    unsigned monitor_mask;
-    double *pnew;
-    double *pold;
-    int i;
-
+  
     /* get alarm mask */
-    monitor_mask = recGblResetAlarms(prec);
+    epicsUInt32   monitor_mask = (epicsUInt32) recGblResetAlarms(prec);
+    epicsFloat64 *pnew;
+    epicsFloat64 *pold;
+    epicsInt32    i = 0;
 
     /* check for value change */
     recGblCheckDeadband(&prec->mlst, prec->val, prec->mdel, &monitor_mask, DBE_VALUE);
diff --git src/std/rec/waveformRecord.c src/std/rec/waveformRecord.c
index 5d3963e..22dfce5 100644
--- src/std/rec/waveformRecord.c
+++ src/std/rec/waveformRecord.c
@@ -270,11 +270,9 @@ static long get_control_double(DBADDR *paddr, struct dbr_ctrlDouble *pcd)
 
 static void monitor(waveformRecord *prec)
 {
-    unsigned short monitor_mask = 0;
-    unsigned int hash = 0;
-
-    monitor_mask = recGblResetAlarms(prec);
-
+    epicsUInt32 monitor_mask = (epicsUInt32) recGblResetAlarms(prec);
+    epicsUInt32 hash = 0;
+    
     if (prec->mpst == waveformPOST_Always)
         monitor_mask |= DBE_VALUE;
     if (prec->apst == waveformPOST_Always)
diff --git src/template/base/top/exampleApp/src/xxxRecord.c src/template/base/top/exampleApp/src/xxxRecord.c
index c2693c4..94fc938 100644
--- src/template/base/top/exampleApp/src/xxxRecord.c
+++ src/template/base/top/exampleApp/src/xxxRecord.c
@@ -241,10 +241,9 @@ static void checkAlarms(xxxRecord *prec)
 
 static void monitor(xxxRecord *prec)
 {
-	unsigned short	monitor_mask;
-	double		delta;
+        epicsUInt32 monitor_mask = (epicsUInt32) recGblResetAlarms(prec);
+	epicsFloat64 delta = 0.0;
 
-        monitor_mask = recGblResetAlarms(prec);
 	/* check for value change */
 	delta = prec->mlst - prec->val;
 	if(delta<0.0) delta = -delta;

Replies:
Re: Patch file for Records which use consistent epics data types Michael Davidsaver
Re: Patch file for Records which use consistent epics data types Michael Davidsaver

Navigate by Date:
Prev: Jenkins build became unstable: epics-base-3.14 #249 APS Jenkins
Next: Re: Patch file for Records which use consistent epics data types Michael Davidsaver
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <2017
Navigate by Thread:
Prev: Jenkins build is back to stable : epics-base-3.14 #250 APS Jenkins
Next: Re: Patch file for Records which use consistent epics data types Michael Davidsaver
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <2017
ANJ, 28 Apr 2017 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·