From 5198a2d552f1b911d5a96189c3ac4530d1af3c08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torsten=20B=C3=B6gershausen?= Date: Wed, 19 Sep 2018 07:45:07 +0200 Subject: [PATCH] Clean up the EPICS_VERSION/rec sup, use motor_epics_inc.h Refactor the changes for the deprecated RECSUP in later EPICS base version, which need a typedef for struct rset. Unite all common code and put it into a single include file. Add motor_epics_inc.h. --- motorApp/MotorSrc/devMotorAsyn.c | 25 +--------------------- motorApp/MotorSrc/motorRecord.cc | 25 ++-------------------- motorApp/MotorSrc/motorUtilAux.cc | 17 ++------------- motorApp/MotorSrc/motor_epics_inc.h | 33 +++++++++++++++++++++++++++++ motorApp/MotorSrc/motordevCom.cc | 22 +------------------ 5 files changed, 39 insertions(+), 83 deletions(-) create mode 100644 motorApp/MotorSrc/motor_epics_inc.h diff --git a/motorApp/MotorSrc/devMotorAsyn.c b/motorApp/MotorSrc/devMotorAsyn.c index 42f0180a..c09834e9 100644 --- a/motorApp/MotorSrc/devMotorAsyn.c +++ b/motorApp/MotorSrc/devMotorAsyn.c @@ -45,36 +45,13 @@ * */ -#include "epicsVersion.h" - -#ifndef VERSION_INT -# define VERSION_INT(V,R,M,P) ( ((V)<<24) | ((R)<<16) | ((M)<<8) | (P)) -#endif - -#define VERSION_INT_3_16 VERSION_INT(3,16,0,0) -#if EPICS_VERSION_INT < VERSION_INT_3_16 -#define RECSUPFUN_CAST (RECSUPFUN) -#else -#define RECSUPFUN_CAST -#define REC_TYPE motorRecord -#define USE_TYPED_RSET -#endif - #include #include #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include /* !! for callocMustSucceed() */ -#include +#include "motor_epics_inc.h" #include #include diff --git a/motorApp/MotorSrc/motorRecord.cc b/motorApp/MotorSrc/motorRecord.cc index befd4945..0129b879 100644 --- a/motorApp/MotorSrc/motorRecord.cc +++ b/motorApp/MotorSrc/motorRecord.cc @@ -194,35 +194,14 @@ USAGE... Motor Record Support. #define VERSION 6.10 -#include "epicsVersion.h" - -#ifndef VERSION_INT -# define VERSION_INT(V,R,M,P) ( ((V)<<24) | ((R)<<16) | ((M)<<8) | (P)) -#endif - -#define VERSION_INT_3_16 VERSION_INT(3,16,0,0) -#if EPICS_VERSION_INT < VERSION_INT_3_16 -#define RECSUPFUN_CAST (RECSUPFUN) -#else -#define RECSUPFUN_CAST -#define REC_TYPE motorRecord -#define USE_TYPED_RSET -#endif - #include #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include #include +#include "motor_epics_inc.h" + #define GEN_SIZE_OFFSET #include "motorRecord.h" #undef GEN_SIZE_OFFSET diff --git a/motorApp/MotorSrc/motorUtilAux.cc b/motorApp/MotorSrc/motorUtilAux.cc index 018cb816..fef1690c 100644 --- a/motorApp/MotorSrc/motorUtilAux.cc +++ b/motorApp/MotorSrc/motorUtilAux.cc @@ -28,22 +28,9 @@ USAGE... Motor Record Utility Support. * .03 09-09-08 rls Visual C++ link errors on improper pdbbase declaration. */ -#include "epicsVersion.h" - -#ifndef VERSION_INT -# define VERSION_INT(V,R,M,P) ( ((V)<<24) | ((R)<<16) | ((M)<<8) | (P)) -#endif - -#define VERSION_INT_3_16 VERSION_INT(3,16,0,0) -#if EPICS_VERSION_INT < VERSION_INT_3_16 -#define RECSUPFUN_CAST (RECSUPFUN) -#else -#define RECSUPFUN_CAST -#define REC_TYPE motorRecord -#define USE_TYPED_RSET -#endif - #include +#include "motor_epics_inc.h" + #include #include diff --git a/motorApp/MotorSrc/motor_epics_inc.h b/motorApp/MotorSrc/motor_epics_inc.h new file mode 100644 index 00000000..0d4698c5 --- /dev/null +++ b/motorApp/MotorSrc/motor_epics_inc.h @@ -0,0 +1,33 @@ +#ifndef INCmotorepicsinc +#define INCmotorepicsinc 1 + +#include "epicsVersion.h" + +#ifndef VERSION_INT +# define VERSION_INT(V,R,M,P) ( ((V)<<24) | ((R)<<16) | ((M)<<8) | (P)) +#endif + +#define VERSION_INT_3_16 VERSION_INT(3,16,0,0) +#if EPICS_VERSION_INT < VERSION_INT_3_16 +#define RECSUPFUN_CAST (RECSUPFUN) +#else +#define RECSUPFUN_CAST +#define REC_TYPE motorRecord +#define USE_TYPED_RSET +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include /* !! for callocMustSucceed() */ +#include +#include + +#endif diff --git a/motorApp/MotorSrc/motordevCom.cc b/motorApp/MotorSrc/motordevCom.cc index 540da34f..b82bc8fa 100644 --- a/motorApp/MotorSrc/motordevCom.cc +++ b/motorApp/MotorSrc/motordevCom.cc @@ -59,31 +59,11 @@ USAGE... This file contains device functions that are common to all motor * motor_init_record_com(). See README R6-10 item #6 for details. */ -#include "epicsVersion.h" - -#ifndef VERSION_INT -# define VERSION_INT(V,R,M,P) ( ((V)<<24) | ((R)<<16) | ((M)<<8) | (P)) -#endif - -#define VERSION_INT_3_16 VERSION_INT(3,16,0,0) -#if EPICS_VERSION_INT < VERSION_INT_3_16 -#define RECSUPFUN_CAST (RECSUPFUN) -#else -#define RECSUPFUN_CAST -#define REC_TYPE motorRecord -#define USE_TYPED_RSET -#endif - #include #include #include -#include -#include -#include -#include -#include -#include +#include "motor_epics_inc.h" #include "motorRecord.h" #include "motor.h"