From e977d63f0853f8d945ff857261ea440b9b7a62c7 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Sat, 15 Apr 2017 17:26:18 -0400 Subject: [PATCH] add pvdVersion.h --- src/Makefile | 19 ++++++++++++++++++- src/pv/Makefile | 3 +++ src/pv/pvIntrospect.h | 1 + src/pv/pvdVersion.cpp | 34 +++++++++++++++++++++++++++++++++ src/pv/pvdVersion.h | 42 +++++++++++++++++++++++++++++++++++++++++ src/pv/pvdVersionNum.h@ | 7 +++++++ 6 files changed, 105 insertions(+), 1 deletion(-) create mode 100644 src/pv/pvdVersion.cpp create mode 100644 src/pv/pvdVersion.h create mode 100644 src/pv/pvdVersionNum.h@ diff --git a/src/Makefile b/src/Makefile index d90f468..8b0cc78 100644 --- a/src/Makefile +++ b/src/Makefile @@ -17,8 +17,25 @@ LIBRARY = pvData pvData_LIBS += Com +EPICS_PVD_MAJOR_VERSION = 7 +EPICS_PVD_MINOR_VERSION = 0 +EPICS_PVD_MAINTENANCE_VERSION = 0 +EPICS_PVD_DEVELOPMENT_FLAG = 1 + +EXPANDVARS += EPICS_PVD_MAJOR_VERSION +EXPANDVARS += EPICS_PVD_MINOR_VERSION +EXPANDVARS += EPICS_PVD_MAINTENANCE_VERSION +EXPANDVARS += EPICS_PVD_DEVELOPMENT_FLAG + +EXPANDFLAGS += $(foreach var,$(EXPANDVARS),-D$(var)="$(strip $($(var)))") + # shared library ABI version. -SHRLIB_VERSION ?= 6.1 +SHRLIB_VERSION = $(EPICS_PVD_MAJOR_VERSION).$(EPICS_PVD_MINOR_VERSION).$(EPICS_PVD_MAINTENANCE_VERSION) include $(TOP)/configure/RULES +# Can't use EXPAND as generated headers must appear +# in O.Common, but EXPAND emits rules for O.$(T_A) +../O.Common/pv/pvdVersionNum.h: ../pv/pvdVersionNum.h@ + $(MKDIR) $(COMMON_DIR)/pv + $(EXPAND_TOOL) $(EXPANDFLAGS) $($@_EXPANDFLAGS) $< $@ diff --git a/src/pv/Makefile b/src/pv/Makefile index 2b7a374..f0b6b1b 100644 --- a/src/pv/Makefile +++ b/src/pv/Makefile @@ -9,4 +9,7 @@ INC += pv/convert.h INC += pv/standardField.h INC += pv/standardPVField.h INC += pv/pvSubArrayCopy.h +INC += pv/pvdVersion.h +INC += pv/pvdVersionNum.h +LIBSRCS += pvdVersion.cpp diff --git a/src/pv/pvIntrospect.h b/src/pv/pvIntrospect.h index 484422d..94afb5b 100644 --- a/src/pv/pvIntrospect.h +++ b/src/pv/pvIntrospect.h @@ -17,6 +17,7 @@ #include #include #include +#include #include diff --git a/src/pv/pvdVersion.cpp b/src/pv/pvdVersion.cpp new file mode 100644 index 0000000..67da5e2 --- /dev/null +++ b/src/pv/pvdVersion.cpp @@ -0,0 +1,34 @@ +/* + * Copyright information and license terms for this software can be + * found in the file LICENSE that is included with the distribution + */ + +#include + +#define epicsExportSharedSymbols +#include + +namespace epics{namespace pvData{ + +void getVersion(epics::pvData::PVDataVersion *ptr) +{ + ptr->major = EPICS_PVD_MAJOR_VERSION; + ptr->minor = EPICS_PVD_MINOR_VERSION; + ptr->maint = EPICS_PVD_MAINTENANCE_VERSION; + ptr->devel = EPICS_PVD_DEVELOPMENT_FLAG; +} + +}} // namespace epics::pvData + +// perhaps helpful in a loadable module + +extern "C" { +epicsShareExtern void getPVDataVersion(epics::pvData::PVDataVersion *ptr, size_t len); + +void getPVDataVersion(epics::pvData::PVDataVersion *ptr, size_t len) +{ + if(len>=sizeof(*ptr)) { + epics::pvData::getVersion(ptr); + } +} +} diff --git a/src/pv/pvdVersion.h b/src/pv/pvdVersion.h new file mode 100644 index 0000000..5ef20ca --- /dev/null +++ b/src/pv/pvdVersion.h @@ -0,0 +1,42 @@ +/* + * Copyright information and license terms for this software can be + * found in the file LICENSE that is included with the distribution + */ +/* pvdVersion.h did not exist prior to 7.0.0 + * from which time it is included by pv/pvIntrospect.h + */ +#ifndef PVDVERSION_H +#define PVDVERSION_H + +#include +#include + +#ifndef VERSION_INT +# define VERSION_INT(V,R,M,P) ( ((V)<<24) | ((R)<<16) | ((M)<<8) | (P)) +#endif + +/* include generated headers with: + * EPICS_PVD_MAJOR_VERSION + * EPICS_PVD_MINOR_VERSION + * EPICS_PVD_MAINTENANCE_VERSION + * EPICS_PVD_DEVELOPMENT_FLAG + */ +#include + +#define PVDATA_VERSION_INT VERSION_INT(EPICS_PVD_MAJOR_VERSION, EPICS_PVD_MINOR_VERSION, EPICS_PVD_MAINTENANCE_VERSION, 0) + +namespace epics{namespace pvData{ + +struct PVDataVersion { + unsigned major; + unsigned minor; + unsigned maint; + unsigned devel; +}; + +epicsShareExtern void getVersion(PVDataVersion *ptr); + +}} // namespace epics::pvData + + +#endif // PVDVERSION_H diff --git a/src/pv/pvdVersionNum.h@ b/src/pv/pvdVersionNum.h@ new file mode 100644 index 0000000..e81b432 --- /dev/null +++ b/src/pv/pvdVersionNum.h@ @@ -0,0 +1,7 @@ +#ifndef PVDVERSION_H +# error include pvdVersion.h, not this header +#endif +#define EPICS_PVD_MAJOR_VERSION @EPICS_PVD_MAJOR_VERSION@ +#define EPICS_PVD_MINOR_VERSION @EPICS_PVD_MINOR_VERSION@ +#define EPICS_PVD_MAINTENANCE_VERSION @EPICS_PVD_MAINTENANCE_VERSION@ +#define EPICS_PVD_DEVELOPMENT_FLAG @EPICS_PVD_DEVELOPMENT_FLAG@