From 2ecf8803c388936193aa7d3c1160590ebd9c0f8a Mon Sep 17 00:00:00 2001
From: Andrew Johnson
Date: Tue, 20 Aug 2013 16:59:28 -0500
Subject: [PATCH 1/3] Move alarm string arrays into libCom
Using idea from Peter Heesterman:
* Instanciate the alarm strings once in libCom
* Remove the epicsAlarmGlobal macro
* Make sure the decorations are right
---
src/ca/client/tools/tool_lib.c | 3 +-
src/libCom/misc/Makefile | 1 +
src/libCom/misc/alarm.h | 9 ------
src/libCom/misc/alarmString.c | 52 ++++++++++++++++++++++++++++++++++
src/libCom/misc/alarmString.h | 45 +++++------------------------
5 files changed, 61 insertions(+), 49 deletions(-)
create mode 100644 src/libCom/misc/alarmString.c
diff --git a/src/ca/client/tools/tool_lib.c b/src/ca/client/tools/tool_lib.c
index ddead1115..45aa6d92e 100644
--- a/src/ca/client/tools/tool_lib.c
+++ b/src/ca/client/tools/tool_lib.c
@@ -25,9 +25,8 @@
#include
#include
-#define epicsAlarmGLOBAL
#include
-#undef epicsAlarmGLOBAL
+#include
#include
#include
#include
diff --git a/src/libCom/misc/Makefile b/src/libCom/misc/Makefile
index d623b3225..3d5412dc3 100644
--- a/src/libCom/misc/Makefile
+++ b/src/libCom/misc/Makefile
@@ -31,6 +31,7 @@ INC += testMain.h
# epicsVersion.h is created by this Makefile
INC += epicsVersion.h
+Com_SRCS += alarmString.c
Com_SRCS += aToIPAddr.c
Com_SRCS += adjustment.c
Com_SRCS += cantProceed.c
diff --git a/src/libCom/misc/alarm.h b/src/libCom/misc/alarm.h
index 6aaab449d..6494e9374 100644
--- a/src/libCom/misc/alarm.h
+++ b/src/libCom/misc/alarm.h
@@ -18,7 +18,6 @@
#define INC_alarm_H
#include "shareLib.h"
-#include "epicsTypes.h"
#ifdef __cplusplus
extern "C" {
@@ -43,8 +42,6 @@ typedef enum {
#define INVALID_ALARM epicsSevInvalid
#define lastEpicsAlarmSev epicsSevInvalid
-epicsShareExtern const char *epicsAlarmSeverityStrings [ALARM_NSEV];
-
/* ALARM STATUS - must match menuAlarmStat.dbd */
@@ -98,15 +95,9 @@ typedef enum {
#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/libCom/misc/alarmString.c b/src/libCom/misc/alarmString.c
new file mode 100644
index 000000000..0c668c888
--- /dev/null
+++ b/src/libCom/misc/alarmString.c
@@ -0,0 +1,52 @@
+/*************************************************************************\
+* 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.
+\*************************************************************************/
+/* $Revision-Id$ */
+
+/* String names for alarm status and severity values */
+
+#define epicsExportSharedSymbols
+#include "alarm.h"
+#include "alarmString.h"
+
+/* ALARM SEVERITIES - must match menuAlarmSevr.dbd and alarm.h */
+
+epicsShareDef const char * epicsAlarmSeverityStrings[ALARM_NSEV] = {
+ "NO_ALARM",
+ "MINOR",
+ "MAJOR",
+ "INVALID"
+};
+
+
+/* ALARM STATUS - must match menuAlarmStat.dbd and alarm.h */
+
+epicsShareDef 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/libCom/misc/alarmString.h b/src/libCom/misc/alarmString.h
index 7051f13ff..bfe6d8b2e 100644
--- a/src/libCom/misc/alarmString.h
+++ b/src/libCom/misc/alarmString.h
@@ -8,59 +8,28 @@
\*************************************************************************/
/* $Revision-Id$ */
-/* String names for alarms */
+/* String names for alarm status and severity values */
#ifndef INC_alarmString_H
#define INC_alarmString_H
+#include "shareLib.h"
+
#ifdef __cplusplus
extern "C" {
#endif
-/* Compatibility with original alarmString.h names */
+/* An older version of alarmString.h used these names: */
#define alarmSeverityString epicsAlarmSeverityStrings
#define alarmStatusString epicsAlarmConditionStrings
-/* Name strings */
+/* Name string arrays */
-/* ALARM SEVERITIES - must match menuAlarmSevr.dbd and alarm.h */
+epicsShareExtern const char *epicsAlarmSeverityStrings [ALARM_NSEV];
+epicsShareExtern const char *epicsAlarmConditionStrings [ALARM_NSTATUS];
-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
}
From f146f9ea6e632673774e7d35e2279f6ae11ab0b3 Mon Sep 17 00:00:00 2001
From: Andrew Johnson
Date: Tue, 12 Nov 2013 16:18:17 -0600
Subject: [PATCH 2/3] Move the string array declarations into alarm.h
This also removes all internal use of alarmString.h which
is now deprecated again (see 3.14.5, Jan 2004).
---
src/ca/client/perl/Cap5.xs | 1 -
src/ca/client/tools/tool_lib.c | 1 -
src/libCom/misc/alarm.h | 8 +++++++-
src/libCom/misc/alarmString.c | 1 -
src/libCom/misc/alarmString.h | 16 +++++++---------
5 files changed, 14 insertions(+), 13 deletions(-)
diff --git a/src/ca/client/perl/Cap5.xs b/src/ca/client/perl/Cap5.xs
index 54ce8decb..e0b9f3650 100644
--- a/src/ca/client/perl/Cap5.xs
+++ b/src/ca/client/perl/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/ca/client/tools/tool_lib.c b/src/ca/client/tools/tool_lib.c
index 45aa6d92e..b503e125a 100644
--- a/src/ca/client/tools/tool_lib.c
+++ b/src/ca/client/tools/tool_lib.c
@@ -26,7 +26,6 @@
#include
#include
-#include
#include
#include
#include
diff --git a/src/libCom/misc/alarm.h b/src/libCom/misc/alarm.h
index 6494e9374..5158206f7 100644
--- a/src/libCom/misc/alarm.h
+++ b/src/libCom/misc/alarm.h
@@ -95,9 +95,15 @@ typedef enum {
#define WRITE_ACCESS_ALARM epicsAlarmWriteAccess
#define lastEpicsAlarmCond epicsAlarmWriteAccess
+
+/* Name string arrays */
+
+epicsShareExtern const char *epicsAlarmSeverityStrings [ALARM_NSEV];
+epicsShareExtern const char *epicsAlarmConditionStrings [ALARM_NSTATUS];
+
+
#ifdef __cplusplus
}
#endif
-
#endif /* INC_alarm_H */
diff --git a/src/libCom/misc/alarmString.c b/src/libCom/misc/alarmString.c
index 0c668c888..b8c72451c 100644
--- a/src/libCom/misc/alarmString.c
+++ b/src/libCom/misc/alarmString.c
@@ -12,7 +12,6 @@
#define epicsExportSharedSymbols
#include "alarm.h"
-#include "alarmString.h"
/* ALARM SEVERITIES - must match menuAlarmSevr.dbd and alarm.h */
diff --git a/src/libCom/misc/alarmString.h b/src/libCom/misc/alarmString.h
index bfe6d8b2e..75fe2317c 100644
--- a/src/libCom/misc/alarmString.h
+++ b/src/libCom/misc/alarmString.h
@@ -8,29 +8,27 @@
\*************************************************************************/
/* $Revision-Id$ */
-/* String names for alarm status and severity values */
+/*
+ * This file is deprecated, use alarm.h instead.
+ *
+ * Old string names for alarm status and severity values
+ */
#ifndef INC_alarmString_H
#define INC_alarmString_H
-#include "shareLib.h"
+#include "alarm.h"
#ifdef __cplusplus
extern "C" {
#endif
-/* An older version of alarmString.h used these names: */
+/* Old versions of alarmString.h defined these names: */
#define alarmSeverityString epicsAlarmSeverityStrings
#define alarmStatusString epicsAlarmConditionStrings
-/* Name string arrays */
-
-epicsShareExtern const char *epicsAlarmSeverityStrings [ALARM_NSEV];
-epicsShareExtern const char *epicsAlarmConditionStrings [ALARM_NSTATUS];
-
-
#ifdef __cplusplus
}
#endif
From b0a330f22af03fb02cb0693281437259afe98210 Mon Sep 17 00:00:00 2001
From: Andrew Johnson
Date: Wed, 30 Jul 2014 18:03:34 -0500
Subject: [PATCH 3/3] Document changes.
---
documentation/RELEASE_NOTES.html | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/documentation/RELEASE_NOTES.html b/documentation/RELEASE_NOTES.html
index bf045b0f3..54ee86c52 100644
--- a/documentation/RELEASE_NOTES.html
+++ b/documentation/RELEASE_NOTES.html
@@ -15,6 +15,15 @@ EPICS Base 3.15.0.x releases are not intended for use in production systems.
Changes between 3.15.0.1 and 3.15.0.2
+alarmString.h deprecated again
+
+The string arrays that provide string versions of the alarm status and
+severity values have been moved into libCom and the header file that used to
+instanciate them is no longer required, although a copy is still provided for
+backwards compatibility reasons. Only the alarm.h header needs to be included
+now to declare the epicsAlarmSeverityStrings and epicsAlarmConditionStrings
+arrays.
+
errlogRemoveListener() routine changed
Code that calls errlogRemoveListener(myfunc) must be modified to use