EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

2002  2003  2004  2005  2006  2007  2008  <20092010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 2002  2003  2004  2005  2006  2007  2008  <20092010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Patch: Move alarm.h and rename alarmString.h
From: Andrew Johnson <[email protected]>
To: "Core-Talk" <[email protected]>
Date: Fri, 12 Jun 2009 17:51:54 -0500
Michael Davidsaver suggests we make the changes in the attached patch, which 
moves alarm.h from src/dbStatic to src/ca and puts the static alarm strings 
into libca.

We've never really got the alarm enums right; there are equivalent definitions 
in src/db/menuAlarmStat.dbd which must match alarm.h, and we currently have 
the header alarmString.h which currently instantiates a global alarm string 
array into whatever file it's included by.  This is used both internally (by 
catools and cap5) and externally (by MEDM, ALH, etc).

Unfortunately there are more alarm status string values than can be 
transported by CA as a DBF_ENUM, and even if they could be this wouldn't help 
very much given that the extended dbr_ types include a stat field anyway.

I have made some (not terribly satisfactory) changes in this area since 
R3.14.10 but Michael's idea of putting the strings into libca seems 
interesting.

Please discuss...

- Andrew
-- 
The best FOSS code is written to be read by other humans -- Harold Welte
From 7f5fbfa4bde1e048426c94749738464bb4917ab4 Mon Sep 17 00:00:00 2001
From: Michael Davidsaver <[email protected]>
Date: Fri, 29 May 2009 11:27:02 -0400
Subject: move alarm.h and rename alarmString.h

Alarm strings should defined in a library not in individual objects.
These strings seem to only be used in CA clients,
but since there is no client only library, place them in libca
which all clients must link with.

deprecate epicsGlobalALARM

rename src/dbStatic/alarm.h -> src/ca/alarm.h
rename src/dbStatic/alarmString.h -> src/ca/alarmString.c
---
 src/ca/Makefile            |    2 +
 src/ca/alarm.h             |  117 ++++++++++++++++++++++++++++++++++++++++++++
 src/ca/alarmString.c       |   51 +++++++++++++++++++
 src/cap5/Cap5.xs           |    1 -
 src/catools/tool_lib.c     |    2 -
 src/dbStatic/Makefile      |    2 -
 src/dbStatic/alarm.h       |  112 ------------------------------------------
 src/dbStatic/alarmString.h |   69 --------------------------
 8 files changed, 170 insertions(+), 186 deletions(-)
 create mode 100644 src/ca/alarm.h
 create mode 100644 src/ca/alarmString.c
 delete mode 100644 src/dbStatic/alarm.h
 delete mode 100644 src/dbStatic/alarmString.h

diff --git a/src/ca/Makefile b/src/ca/Makefile
index db4186d..aff33df 100644
--- a/src/ca/Makefile
+++ b/src/ca/Makefile
@@ -17,6 +17,7 @@ HTMLS += CAref.html
 #
 #	includes to install from this subproject
 #
+INC += alarm.h
 INC += cadef.h
 INC += caerr.h
 INC += caeventmask.h
@@ -26,6 +27,7 @@ INC += addrList.h
 INC += cacIO.h
 INC += caDiagnostics.h
 
+LIBSRCS += alarmString.c
 LIBSRCS += cac.cpp
 LIBSRCS += cacChannel.cpp
 LIBSRCS += cacChannelNotify.cpp
diff --git a/src/ca/alarm.h b/src/ca/alarm.h
new file mode 100644
index 0000000..28f89b2
--- /dev/null
+++ b/src/ca/alarm.h
@@ -0,0 +1,117 @@
+/*************************************************************************\
+* Copyright (c) 2009 UChicago Argonne LLC, as Operator of Argonne
+*     National Laboratory.
+* Copyright (c) 2002 The Regents of the University of California, as
+*     Operator of Los Alamos National Laboratory.
+* EPICS BASE is distributed subject to a Software License Agreement found
+* in file LICENSE that is included with this distribution. 
+\*************************************************************************/
+/* Alarm definitions, must match menuAlarmSevr.dbd and menuAlarmStat.dbd */
+/* alarm.h,v 1.6.2.2 2009/03/03 17:15:10 anj Exp */
+
+/*
+ *      Authors: Bob Dalesio and Marty Kraimer
+ *      Date:    11-7-90
+ */
+
+#ifndef INC_alarm_H
+#define INC_alarm_H
+
+#include "shareLib.h"
+#include "epicsTypes.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#define NO_ALARM            0
+
+/* ALARM SEVERITIES - must match menuAlarmSevr.dbd */
+
+typedef enum {
+    epicsSevNone = NO_ALARM,
+    epicsSevMinor,
+    epicsSevMajor,
+    epicsSevInvalid,
+    ALARM_NSEV
+} epicsAlarmSeverity;
+
+#define firstEpicsAlarmSev  epicsSevNone
+#define MINOR_ALARM         epicsSevMinor
+#define MAJOR_ALARM         epicsSevMajor
+#define INVALID_ALARM       epicsSevInvalid
+#define lastEpicsAlarmSev   epicsSevInvalid
+
+epicsShareExtern const char *epicsAlarmSeverityStrings [ALARM_NSEV];
+
+
+/* ALARM STATUS - must match menuAlarmStat.dbd */
+
+typedef enum {
+    epicsAlarmNone = NO_ALARM,
+    epicsAlarmRead,
+    epicsAlarmWrite,
+    epicsAlarmHiHi,
+    epicsAlarmHigh,
+    epicsAlarmLoLo,
+    epicsAlarmLow,
+    epicsAlarmState,
+    epicsAlarmCos,
+    epicsAlarmComm,
+    epicsAlarmTimeout,
+    epicsAlarmHwLimit,
+    epicsAlarmCalc,
+    epicsAlarmScan,
+    epicsAlarmLink,
+    epicsAlarmSoft,
+    epicsAlarmBadSub,
+    epicsAlarmUDF,
+    epicsAlarmDisable,
+    epicsAlarmSimm,
+    epicsAlarmReadAccess,
+    epicsAlarmWriteAccess,
+    ALARM_NSTATUS
+} epicsAlarmCondition;
+
+#define firstEpicsAlarmCond epicsAlarmNone
+#define READ_ALARM          epicsAlarmRead
+#define WRITE_ALARM         epicsAlarmWrite
+#define HIHI_ALARM          epicsAlarmHiHi
+#define HIGH_ALARM          epicsAlarmHigh
+#define LOLO_ALARM          epicsAlarmLoLo
+#define LOW_ALARM           epicsAlarmLow
+#define STATE_ALARM         epicsAlarmState
+#define COS_ALARM           epicsAlarmCos
+#define COMM_ALARM          epicsAlarmComm
+#define TIMEOUT_ALARM       epicsAlarmTimeout
+#define HW_LIMIT_ALARM      epicsAlarmHwLimit
+#define CALC_ALARM          epicsAlarmCalc
+#define SCAN_ALARM          epicsAlarmScan
+#define LINK_ALARM          epicsAlarmLink
+#define SOFT_ALARM          epicsAlarmSoft
+#define BAD_SUB_ALARM       epicsAlarmBadSub
+#define UDF_ALARM           epicsAlarmUDF
+#define DISABLE_ALARM       epicsAlarmDisable
+#define SIMM_ALARM          epicsAlarmSimm
+#define READ_ACCESS_ALARM   epicsAlarmReadAccess
+#define WRITE_ACCESS_ALARM  epicsAlarmWriteAccess
+#define lastEpicsAlarmCond  epicsAlarmWriteAccess
+
+epicsShareExtern const char *epicsAlarmConditionStrings [ALARM_NSTATUS];
+
+#ifdef __cplusplus
+}
+#endif
+
+#ifdef epicsAlarmGLOBAL
+#  error "epicsAlarmGLOBAL is deprecated.  Symbols defined in libca"
+#endif
+
+/* Compatibility with original alarmString.h names */
+
+#define alarmSeverityString epicsAlarmSeverityStrings
+#define alarmStatusString epicsAlarmConditionStrings
+
+
+#endif /* INC_alarm_H */
diff --git a/src/ca/alarmString.c b/src/ca/alarmString.c
new file mode 100644
index 0000000..5c6ce9d
--- /dev/null
+++ b/src/ca/alarmString.c
@@ -0,0 +1,51 @@
+/*************************************************************************\
+* Copyright (c) 2009 UChicago Argonne LLC, as Operator of Argonne
+*     National Laboratory.
+* Copyright (c) 2002 The Regents of the University of California, as
+*     Operator of Los Alamos National Laboratory.
+* EPICS BASE is distributed subject to a Software License Agreement found
+* in file LICENSE that is included with this distribution. 
+\*************************************************************************/
+/* alarmString.h,v 1.4.2.3 2009/03/03 17:15:10 anj Exp */
+
+/* String names for alarms */
+
+/* ALARM SEVERITIES - must match menuAlarmSevr.dbd and alarm.h */
+
+#define epicsExportSharedSymbols
+#include "alarm.h"
+
+const char * epicsAlarmSeverityStrings[ALARM_NSEV] = {
+    "NO_ALARM",
+    "MINOR",
+    "MAJOR",
+    "INVALID"
+};
+
+
+/* ALARM STATUS - must match menuAlarmStat.dbd and alarm.h */
+
+const char * epicsAlarmConditionStrings[ALARM_NSTATUS] = {
+    "NO_ALARM",
+    "READ",
+    "WRITE",
+    "HIHI",
+    "HIGH",
+    "LOLO",
+    "LOW",
+    "STATE",
+    "COS",
+    "COMM",
+    "TIMEOUT",
+    "HWLIMIT",
+    "CALC",
+    "SCAN",
+    "LINK",
+    "SOFT",
+    "BAD_SUB",
+    "UDF",
+    "DISABLE",
+    "SIMM",
+    "READ_ACCESS",
+    "WRITE_ACCESS"
+};
diff --git a/src/cap5/Cap5.xs b/src/cap5/Cap5.xs
index eb96f9e..65213f4 100644
--- a/src/cap5/Cap5.xs
+++ b/src/cap5/Cap5.xs
@@ -11,7 +11,6 @@
 #include "cadef.h"
 #include "db_access.h"
 #include "alarm.h"
-#include "alarmString.h"
 
 typedef union {
     dbr_long_t iv;
diff --git a/src/catools/tool_lib.c b/src/catools/tool_lib.c
index 7ffc9ef..67ed4b8 100644
--- a/src/catools/tool_lib.c
+++ b/src/catools/tool_lib.c
@@ -25,9 +25,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-#define epicsAlarmGLOBAL
 #include <alarm.h>
-#undef epicsAlarmGLOBAL
 #include <epicsTime.h>
 #include <epicsString.h>
 #include <cadef.h>
diff --git a/src/dbStatic/Makefile b/src/dbStatic/Makefile
index 01fe4cf..b3d58a1 100644
--- a/src/dbStatic/Makefile
+++ b/src/dbStatic/Makefile
@@ -10,8 +10,6 @@ TOP=../..
 
 include $(TOP)/configure/CONFIG
 
-INC += alarm.h
-INC += alarmString.h
 INC += dbBase.h
 INC += dbFldTypes.h
 INC += dbStaticLib.h
diff --git a/src/dbStatic/alarm.h b/src/dbStatic/alarm.h
deleted file mode 100644
index ca8abd0..0000000
--- a/src/dbStatic/alarm.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/*************************************************************************\
-* Copyright (c) 2009 UChicago Argonne LLC, as Operator of Argonne
-*     National Laboratory.
-* Copyright (c) 2002 The Regents of the University of California, as
-*     Operator of Los Alamos National Laboratory.
-* EPICS BASE is distributed subject to a Software License Agreement found
-* in file LICENSE that is included with this distribution. 
-\*************************************************************************/
-/* Alarm definitions, must match menuAlarmSevr.dbd and menuAlarmStat.dbd */
-/* alarm.h,v 1.6.2.2 2009/03/03 17:15:10 anj Exp */
-
-/*
- *      Authors: Bob Dalesio and Marty Kraimer
- *      Date:    11-7-90
- */
-
-#ifndef INC_alarm_H
-#define INC_alarm_H
-
-#include "shareLib.h"
-#include "epicsTypes.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-#define NO_ALARM            0
-
-/* ALARM SEVERITIES - must match menuAlarmSevr.dbd */
-
-typedef enum {
-    epicsSevNone = NO_ALARM,
-    epicsSevMinor,
-    epicsSevMajor,
-    epicsSevInvalid,
-    ALARM_NSEV
-} epicsAlarmSeverity;
-
-#define firstEpicsAlarmSev  epicsSevNone
-#define MINOR_ALARM         epicsSevMinor
-#define MAJOR_ALARM         epicsSevMajor
-#define INVALID_ALARM       epicsSevInvalid
-#define lastEpicsAlarmSev   epicsSevInvalid
-
-epicsShareExtern const char *epicsAlarmSeverityStrings [ALARM_NSEV];
-
-
-/* ALARM STATUS - must match menuAlarmStat.dbd */
-
-typedef enum {
-    epicsAlarmNone = NO_ALARM,
-    epicsAlarmRead,
-    epicsAlarmWrite,
-    epicsAlarmHiHi,
-    epicsAlarmHigh,
-    epicsAlarmLoLo,
-    epicsAlarmLow,
-    epicsAlarmState,
-    epicsAlarmCos,
-    epicsAlarmComm,
-    epicsAlarmTimeout,
-    epicsAlarmHwLimit,
-    epicsAlarmCalc,
-    epicsAlarmScan,
-    epicsAlarmLink,
-    epicsAlarmSoft,
-    epicsAlarmBadSub,
-    epicsAlarmUDF,
-    epicsAlarmDisable,
-    epicsAlarmSimm,
-    epicsAlarmReadAccess,
-    epicsAlarmWriteAccess,
-    ALARM_NSTATUS
-} epicsAlarmCondition;
-
-#define firstEpicsAlarmCond epicsAlarmNone
-#define READ_ALARM          epicsAlarmRead
-#define WRITE_ALARM         epicsAlarmWrite
-#define HIHI_ALARM          epicsAlarmHiHi
-#define HIGH_ALARM          epicsAlarmHigh
-#define LOLO_ALARM          epicsAlarmLoLo
-#define LOW_ALARM           epicsAlarmLow
-#define STATE_ALARM         epicsAlarmState
-#define COS_ALARM           epicsAlarmCos
-#define COMM_ALARM          epicsAlarmComm
-#define TIMEOUT_ALARM       epicsAlarmTimeout
-#define HW_LIMIT_ALARM      epicsAlarmHwLimit
-#define CALC_ALARM          epicsAlarmCalc
-#define SCAN_ALARM          epicsAlarmScan
-#define LINK_ALARM          epicsAlarmLink
-#define SOFT_ALARM          epicsAlarmSoft
-#define BAD_SUB_ALARM       epicsAlarmBadSub
-#define UDF_ALARM           epicsAlarmUDF
-#define DISABLE_ALARM       epicsAlarmDisable
-#define SIMM_ALARM          epicsAlarmSimm
-#define READ_ACCESS_ALARM   epicsAlarmReadAccess
-#define WRITE_ACCESS_ALARM  epicsAlarmWriteAccess
-#define lastEpicsAlarmCond  epicsAlarmWriteAccess
-
-epicsShareExtern const char *epicsAlarmConditionStrings [ALARM_NSTATUS];
-
-#ifdef __cplusplus
-}
-#endif
-
-#ifdef epicsAlarmGLOBAL
-#  include "alarmString.h"
-#endif
-
-
-#endif /* INC_alarm_H */
diff --git a/src/dbStatic/alarmString.h b/src/dbStatic/alarmString.h
deleted file mode 100644
index 6b5e687..0000000
--- a/src/dbStatic/alarmString.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*************************************************************************\
-* Copyright (c) 2009 UChicago Argonne LLC, as Operator of Argonne
-*     National Laboratory.
-* Copyright (c) 2002 The Regents of the University of California, as
-*     Operator of Los Alamos National Laboratory.
-* EPICS BASE is distributed subject to a Software License Agreement found
-* in file LICENSE that is included with this distribution. 
-\*************************************************************************/
-/* alarmString.h,v 1.4.2.3 2009/03/03 17:15:10 anj Exp */
-
-/* String names for alarms */
-
-#ifndef INC_alarmString_H
-#define INC_alarmString_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Compatibility with original alarmString.h names */
-
-#define alarmSeverityString epicsAlarmSeverityStrings
-#define alarmStatusString epicsAlarmConditionStrings
-
-
-/* Name strings */
-
-/* ALARM SEVERITIES - must match menuAlarmSevr.dbd and alarm.h */
-
-const char * epicsAlarmSeverityStrings[] = {
-    "NO_ALARM",
-    "MINOR",
-    "MAJOR",
-    "INVALID"
-};
-
-
-/* ALARM STATUS - must match menuAlarmStat.dbd and alarm.h */
-
-const char * epicsAlarmConditionStrings[] = {
-    "NO_ALARM",
-    "READ",
-    "WRITE",
-    "HIHI",
-    "HIGH",
-    "LOLO",
-    "LOW",
-    "STATE",
-    "COS",
-    "COMM",
-    "TIMEOUT",
-    "HWLIMIT",
-    "CALC",
-    "SCAN",
-    "LINK",
-    "SOFT",
-    "BAD_SUB",
-    "UDF",
-    "DISABLE",
-    "SIMM",
-    "READ_ACCESS",
-    "WRITE_ACCESS"
-};
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-- 
1.5.6.5


Replies:
RE: Patch: Move alarm.h and rename alarmString.h Davidsaver, Michael
Re: Patch: Move alarm.h and rename alarmString.h Benjamin Franksen

Navigate by Date:
Prev: RE: Faster re-connect for CA clients Jeff Hill
Next: RE: Patch: Move alarm.h and rename alarmString.h Davidsaver, Michael
Index: 2002  2003  2004  2005  2006  2007  2008  <20092010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: RE: Faster re-connect for CA clients Jeff Hill
Next: RE: Patch: Move alarm.h and rename alarmString.h Davidsaver, Michael
Index: 2002  2003  2004  2005  2006  2007  2008  <20092010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 02 Feb 2012 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·