add pvdVersion.h

This commit is contained in:
Michael Davidsaver
2017-04-15 17:26:18 -04:00
parent 08fc3cab38
commit e977d63f08
6 changed files with 105 additions and 1 deletions

View File

@@ -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) $< $@

View File

@@ -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

View File

@@ -17,6 +17,7 @@
#include <pv/pvType.h>
#include <pv/byteBuffer.h>
#include <pv/serialize.h>
#include <pv/pvdVersion.h>
#include <shareLib.h>

34
src/pv/pvdVersion.cpp Normal file
View File

@@ -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 <stdlib.h>
#define epicsExportSharedSymbols
#include <pv/pvdVersion.h>
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);
}
}
}

42
src/pv/pvdVersion.h Normal file
View File

@@ -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 <epicsVersion.h>
#include <shareLib.h>
#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 <pv/pvdVersionNum.h>
#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

7
src/pv/pvdVersionNum.h@ Normal file
View File

@@ -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@