From ee795dfa1ff22bbb06bf9257f7089abbff136911 Mon Sep 17 00:00:00 2001 From: Ron Sluiter Date: Tue, 29 Nov 2011 20:50:00 +0000 Subject: [PATCH] Changed diagnostic message macro 'Debug' to Mark Rivers inline variable argument function calls. --- motorApp/AcsSrc/devMCB4B.cc | 25 +++++++++++---------- motorApp/AcsSrc/drvMCB4B.cc | 26 +++++++++++---------- motorApp/AcsTech80Src/drvSPiiPlus.cc | 19 ++++++++-------- motorApp/AerotechSrc/drvSoloist.cc | 19 ++++++++-------- motorApp/DeltaTauSrc/drvPmac.cc | 25 +++++++++++---------- motorApp/FaulhaberSrc/drvMCDC2805.cc | 28 +++++++++++++---------- motorApp/ImsSrc/drvIM483PL.cc | 28 ++++++++++++----------- motorApp/ImsSrc/drvIM483SM.cc | 27 ++++++++++++---------- motorApp/ImsSrc/drvMDrive.cc | 20 +++++++++-------- motorApp/KohzuSrc/drvSC800.cc | 20 +++++++++-------- motorApp/MXmotorSrc/drvMXmotor.cc | 30 ++++++++++++++----------- motorApp/MclennanSrc/devPM304.cc | 25 +++++++++++---------- motorApp/MclennanSrc/drvPM304.cc | 27 +++++++++++----------- motorApp/MicosSrc/devMicos.cc | 23 ++++++++++--------- motorApp/MicosSrc/drvMicos.cc | 20 +++++++++-------- motorApp/MicroMoSrc/drvMVP2001.cc | 26 ++++++++++----------- motorApp/NewFocusSrc/drvPMNC87xx.cc | 20 +++++++++-------- motorApp/NewportSrc/drvESP300.cc | 27 ++++++++++++---------- motorApp/NewportSrc/drvMM3000.cc | 19 ++++++++-------- motorApp/NewportSrc/drvMM4000.cc | 19 ++++++++-------- motorApp/NewportSrc/drvPM500.cc | 26 +++++++++++---------- motorApp/OmsSrc/drvMAXv_trajectory.cc | 28 +++++++++++------------ motorApp/OmsSrc/drvOms.cc | 20 ++++++++--------- motorApp/OmsSrc/drvOms58.cc | 20 ++++++++--------- motorApp/OmsSrc/drvOmsPC68.cc | 21 +++++++++-------- motorApp/OrielSrc/drvEMC18011.cc | 27 +++++++++++----------- motorApp/PC6KSrc/drvPC6K.cc | 27 +++++++++++----------- motorApp/PiJenaSrc/drvPIJEDS.cc | 27 +++++++++++----------- motorApp/PiSrc/devPIC630.cc | 24 ++++++++++---------- motorApp/PiSrc/drvPIC630.cc | 19 ++++++++-------- motorApp/PiSrc/drvPIC662.cc | 19 ++++++++-------- motorApp/PiSrc/drvPIC663.cc | 19 ++++++++-------- motorApp/PiSrc/drvPIC844.cc | 19 ++++++++-------- motorApp/PiSrc/drvPIC862.cc | 19 ++++++++-------- motorApp/PiSrc/drvPIE516.cc | 19 ++++++++-------- motorApp/PiSrc/drvPIE710.cc | 19 ++++++++-------- motorApp/SmartMotorSrc/drvSmartMotor.cc | 22 +++++++++--------- motorApp/SoftMotorSrc/devSoft.cc | 20 ++++++++--------- motorApp/ThorLabsSrc/drvMDT695.cc | 19 ++++++++-------- 39 files changed, 467 insertions(+), 420 deletions(-) diff --git a/motorApp/AcsSrc/devMCB4B.cc b/motorApp/AcsSrc/devMCB4B.cc index 775e34e1..d4a394e9 100644 --- a/motorApp/AcsSrc/devMCB4B.cc +++ b/motorApp/AcsSrc/devMCB4B.cc @@ -29,19 +29,20 @@ extern struct driver_table MCB4B_access; #define NINT(f) (long)((f)>0 ? (f)+0.5 : (f)-0.5) -#ifdef __GNUG__ - #ifdef DEBUG - volatile int devMCB4BDebug = 0; - #define Debug(L, FMT, V...) { if(L <= devMCB4BDebug) \ - { errlogPrintf("%s(%d):",__FILE__,__LINE__); \ - errlogPrintf(FMT,##V); } } - #else - #define Debug(L, FMT, V...) - #endif -#else - #define Debug() -#endif +volatile int devMCB4BDebug = 0; +extern "C" {epicsExportAddress(int, devMCB4BDebug);} +static inline void Debug(int level, const char *format, ...) { + #ifdef DEBUG + if (level < devMCB4BDebug) + { + va_list pVar; + va_start(pVar, format); + vprintf(format, pVar); + va_end(pVar); + } + #endif +} /* Debugging levels: * devMCB4BDebug >= 3 Print new part of command and command string so far diff --git a/motorApp/AcsSrc/drvMCB4B.cc b/motorApp/AcsSrc/drvMCB4B.cc index 2dc4865c..ea182924 100644 --- a/motorApp/AcsSrc/drvMCB4B.cc +++ b/motorApp/AcsSrc/drvMCB4B.cc @@ -35,18 +35,20 @@ #define BUFF_SIZE 100 /* Maximum length of string to/from MCB4B */ -#ifdef __GNUG__ - #ifdef DEBUG - volatile int drvMCB4BDebug = 0; - #define Debug(L, FMT, V...) { if(L <= drvMCB4BDebug) \ - { printf("%s(%d):",__FILE__,__LINE__); \ - printf(FMT,##V); } } - #else - #define Debug(L, FMT, V...) - #endif -#else - #define Debug() -#endif +volatile int drvMCB4BDebug = 0; +extern "C" {epicsExportAddress(int, drvMCB4BDebug);} + +static inline void Debug(int level, const char *format, ...) { + #ifdef DEBUG + if (level < drvMCB4BDebug) + { + va_list pVar; + va_start(pVar, format); + vprintf(format, pVar); + va_end(pVar); + } + #endif +} /* Debugging notes: * drvMCB4BDebug == 0 No debugging information is printed diff --git a/motorApp/AcsTech80Src/drvSPiiPlus.cc b/motorApp/AcsTech80Src/drvSPiiPlus.cc index 1f9f55ef..91f124eb 100644 --- a/motorApp/AcsTech80Src/drvSPiiPlus.cc +++ b/motorApp/AcsTech80Src/drvSPiiPlus.cc @@ -72,17 +72,18 @@ HeadURL: $URL$ #define TIMEOUT 2.0 /* Command timeout in sec. */ /*----------------debugging-----------------*/ -#ifdef __GNUG__ - #ifdef DEBUG - #define Debug(l, f, args...) { if(l<=drvSPiiPlusdebug) printf(f,## args); } - #else - #define Debug(l, f, args...) - #endif -#else - #define Debug() -#endif volatile int drvSPiiPlusdebug = 0; extern "C" {epicsExportAddress(int, drvSPiiPlusdebug);} +static inline void Debug(int level, const char *format, ...) { + #ifdef DEBUG + if (level < drvSPiiPlusdebug) { + va_list pVar; + va_start(pVar, format); + vprintf(format, pVar); + va_end(pVar); + } + #endif +} /* --- Local data. --- */ int SPiiPlus_num_cards = 0; diff --git a/motorApp/AerotechSrc/drvSoloist.cc b/motorApp/AerotechSrc/drvSoloist.cc index fb65ea3f..6b95a1fc 100644 --- a/motorApp/AerotechSrc/drvSoloist.cc +++ b/motorApp/AerotechSrc/drvSoloist.cc @@ -77,17 +77,18 @@ #define TIMEOUT 20.0 /* Command timeout in sec. */ /*----------------debugging-----------------*/ -#ifdef __GNUG__ -#ifdef DEBUG -#define Debug(l, f, args...) { if (l<=drvSoloistdebug) printf(f,## args); } -#else -#define Debug(l, f, args...) -#endif -#else -#define Debug() -#endif volatile int drvSoloistdebug = 0; extern "C" {epicsExportAddress(int, drvSoloistdebug);} +static inline void Debug(int level, const char *format, ...) { + #ifdef DEBUG + if (level < drvSoloistdebug) { + va_list pVar; + va_start(pVar, format); + vprintf(format, pVar); + va_end(pVar); + } + #endif +} /* --- Local data. --- */ int Soloist_num_cards = 0; diff --git a/motorApp/DeltaTauSrc/drvPmac.cc b/motorApp/DeltaTauSrc/drvPmac.cc index 10d8382e..960f8b16 100644 --- a/motorApp/DeltaTauSrc/drvPmac.cc +++ b/motorApp/DeltaTauSrc/drvPmac.cc @@ -76,21 +76,22 @@ Last Modified: $Date: 2009-09-08 18:25:19 $ #define ACK 0x06 #define CR 0x0D - -/*----------------debugging-----------------*/ -#ifdef __GNUG__ - #ifdef DEBUG - #define Debug(l, f, args...) {if (l <= drvPmacdebug) \ - errlogPrintf(f, ## args);} - #else - #define Debug(l, f, args...) - #endif -#else - #define Debug -#endif volatile int drvPmacdebug = 0; extern "C" {epicsExportAddress(int, drvPmacdebug);} +/*----------------debugging-----------------*/ + +static inline void Debug(int level, const char *format, ...) { + #ifdef DEBUG + if (level < drvPmacdebug) { + va_list pVar; + va_start(pVar, format); + vprintf(format, pVar); + va_end(pVar); + } + #endif +} + /* Global data. */ int Pmac_num_cards = 0; diff --git a/motorApp/FaulhaberSrc/drvMCDC2805.cc b/motorApp/FaulhaberSrc/drvMCDC2805.cc index b470257e..19b785f6 100644 --- a/motorApp/FaulhaberSrc/drvMCDC2805.cc +++ b/motorApp/FaulhaberSrc/drvMCDC2805.cc @@ -2,9 +2,11 @@ FILENAME... drvMCDC2805.cc USAGE... Motor record driver level support for Faulhaber MCDC2805 -Version: $Revision: 1.4 $ -Modified By: $Author: sluiter $ -Last Modified: $Date: 2009-09-08 18:25:39 $ +Version: $Revision$ +Modified By: $Author$ +Last Modified: $Date$ +HeadURL: $URL$ +Last Modified: $Date$ */ /* @@ -59,18 +61,20 @@ DESIGN LIMITATIONS... #define BUFF_SIZE 100 /* Maximum length of string to/from MCDC2805 */ /*----------------debugging-----------------*/ -#ifdef __GNUG__ - #ifdef DEBUG - #define Debug(l, f, args...) {if (l <= drvMCDC2805debug) printf(f, ## args);} - #else - #define Debug(l, f, args...) - #endif -#else - #define Debug() -#endif volatile int drvMCDC2805debug = 0; extern "C" {epicsExportAddress(int, drvMCDC2805debug);} +static inline void Debug(int level, const char *format, ...) { + #ifdef DEBUG + if (level < drvMCDC2805debug) { + va_list pVar; + va_start(pVar, format); + vprintf(format, pVar); + va_end(pVar); + } + #endif +} + /* --- Local data. --- */ int MCDC2805_num_cards = 0; static char *MCDC2805_axis[] = {"0", "1", "2", "3", "4", "5", "6", "7"}; diff --git a/motorApp/ImsSrc/drvIM483PL.cc b/motorApp/ImsSrc/drvIM483PL.cc index c3aec183..43ecf34e 100644 --- a/motorApp/ImsSrc/drvIM483PL.cc +++ b/motorApp/ImsSrc/drvIM483PL.cc @@ -3,9 +3,10 @@ FILENAME... drvIM483PL.cc USAGE... Motor record driver level support for Intelligent Motion Systems, Inc. IM483(I/IE). -Version: $Revision: 1.17 $ -Modified By: $Author: sluiter $ -Last Modified: $Date: 2006-01-31 22:09:15 $ +Version: $Revision$ +Modified By: $Author$ +Last Modified: $Date$ +HeadURL: $URL$ */ /***************************************************************** @@ -74,20 +75,21 @@ DESIGN LIMITATIONS... #define MAX_AXES 8 #define BUFF_SIZE 50 /* Maximum length of string to/from IM483PL */ - /*----------------debugging-----------------*/ -#ifdef __GNUG__ - #ifdef DEBUG - #define Debug(l, f, args...) {if (l <= drvIM483PLdebug) printf(f, ## args);} - #else - #define Debug(l, f, args...) - #endif -#else - #define Debug() -#endif volatile int drvIM483PLdebug = 0; extern "C" {epicsExportAddress(int, drvIM483PLdebug);} +static inline void Debug(int level, const char *format, ...) { + #ifdef DEBUG + if (level < drvIM483PLdebug) { + va_list pVar; + va_start(pVar, format); + vprintf(format, pVar); + va_end(pVar); + } + #endif +} + /* --- Local data. --- */ int IM483PL_num_cards = 0; static char *IM483PL_axis[] = {"A", "B", "C", "D", "E", "F", "G", "H"}; diff --git a/motorApp/ImsSrc/drvIM483SM.cc b/motorApp/ImsSrc/drvIM483SM.cc index e0714a31..9db3f09c 100644 --- a/motorApp/ImsSrc/drvIM483SM.cc +++ b/motorApp/ImsSrc/drvIM483SM.cc @@ -3,9 +3,10 @@ FILENAME... drvIM483SM.cc USAGE... Motor record driver level support for Intelligent Motion Systems, Inc. IM483(I/IE). -Version: $Revision: 1.18 $ -Modified By: $Author: sluiter $ -Last Modified: $Date: 2006-01-31 22:09:15 $ +Version: $Revision$ +Modified By: $Author$ +Last Modified: $Date$ +HeadURL: $URL$ */ /***************************************************************** @@ -73,18 +74,20 @@ DESIGN LIMITATIONS... #define BUFF_SIZE 50 /* Maximum length of string to/from IM483 */ /*----------------debugging-----------------*/ -#ifdef __GNUG__ - #ifdef DEBUG - #define Debug(l, f, args...) {if (l <= drvIM483SMdebug) printf(f, ## args);} - #else - #define Debug(l, f, args...) - #endif -#else - #define Debug() -#endif volatile int drvIM483SMdebug = 0; extern "C" {epicsExportAddress(int, drvIM483SMdebug);} +static inline void Debug(int level, const char *format, ...) { + #ifdef DEBUG + if (level < drvIM483SMdebug) { + va_list pVar; + va_start(pVar, format); + vprintf(format, pVar); + va_end(pVar); + } + #endif +} + /* --- Local data. --- */ int IM483SM_num_cards = 0; diff --git a/motorApp/ImsSrc/drvMDrive.cc b/motorApp/ImsSrc/drvMDrive.cc index c0688a3c..7f2347a3 100644 --- a/motorApp/ImsSrc/drvMDrive.cc +++ b/motorApp/ImsSrc/drvMDrive.cc @@ -84,18 +84,20 @@ DESIGN LIMITATIONS... #define BUFF_SIZE 13 /* Maximum length of string to/from MDrive */ /*----------------debugging-----------------*/ -#ifdef __GNUG__ - #ifdef DEBUG - #define Debug(l, f, args...) {if (l <= drvMDrivedebug) printf(f, ## args);} - #else - #define Debug(l, f, args...) - #endif -#else - #define Debug() -#endif volatile int drvMDrivedebug = 0; extern "C" {epicsExportAddress(int, drvMDrivedebug);} +static inline void Debug(int level, const char *format, ...) { + #ifdef DEBUG + if (level < drvMDrivedebug) { + va_list pVar; + va_start(pVar, format); + vprintf(format, pVar); + va_end(pVar); + } + #endif +} + /* --- Local data. --- */ int MDrive_num_cards = 0; static char *MDrive_axis[] = {"1", "2", "3", "4", "5", "6", "7", "8"}; diff --git a/motorApp/KohzuSrc/drvSC800.cc b/motorApp/KohzuSrc/drvSC800.cc index 3bd90faf..2bd2b89a 100644 --- a/motorApp/KohzuSrc/drvSC800.cc +++ b/motorApp/KohzuSrc/drvSC800.cc @@ -67,18 +67,20 @@ HeadURL: $URL$ #define MOTION_DELAY 0.1 /*----------------debugging-----------------*/ -#ifdef __GNUG__ - #ifdef DEBUG - #define Debug(l, f, args...) { if(l<=drvSC800debug) printf(f,## args); } - #else - #define Debug(l, f, args...) - #endif -#else - #define Debug() -#endif volatile int drvSC800debug = 0; extern "C" {epicsExportAddress(int, drvSC800debug);} +static inline void Debug(int level, const char *format, ...) { + #ifdef DEBUG + if (level < drvSC800debug) { + va_list pVar; + va_start(pVar, format); + vprintf(format, pVar); + va_end(pVar); + } + #endif +} + /* --- Local data. --- */ int SC800_num_cards = 0; diff --git a/motorApp/MXmotorSrc/drvMXmotor.cc b/motorApp/MXmotorSrc/drvMXmotor.cc index 17da8085..75464c15 100644 --- a/motorApp/MXmotorSrc/drvMXmotor.cc +++ b/motorApp/MXmotorSrc/drvMXmotor.cc @@ -2,9 +2,10 @@ FILENAME... drvMXmotor.cc USAGE... Motor record driver level support for MX device driver. -Version: $Revision: 1.9 $ -Modified By: $Author: sluiter $ -Last Modified: $Date: 2005-05-10 16:34:35 $ +Version: $Revision$ +Modified By: $Author$ +Last Modified: $Date$ +HeadURL: $URL$ */ /* @@ -36,16 +37,19 @@ Last Modified: $Date: 2005-05-10 16:34:35 $ #include "epicsExport.h" /*----------------debugging-----------------*/ -#ifdef __GNUG__ - #ifdef DEBUG - volatile int drvMXmotordebug = 0; - #define Debug(l, f, args...) { if(l<=drvMXmotordebug) printf(f,## args); } - #else - #define Debug(l, f, args...) - #endif -#else - #define Debug() -#endif +volatile int drvMXmotordebug = 0; +extern "C" {epicsExportAddress(int, drvMXmotordebug);} + +static inline void Debug(int level, const char *format, ...) { + #ifdef DEBUG + if (level < drvMXmotordebug) { + va_list pVar; + va_start(pVar, format); + vprintf(format, pVar); + va_end(pVar); + } + #endif +} /* Global data. */ int MXmotor_num_cards = 0; diff --git a/motorApp/MclennanSrc/devPM304.cc b/motorApp/MclennanSrc/devPM304.cc index 34a229f3..63797b23 100644 --- a/motorApp/MclennanSrc/devPM304.cc +++ b/motorApp/MclennanSrc/devPM304.cc @@ -37,19 +37,20 @@ extern struct driver_table PM304_access; #define NINT(f) (long)((f)>0 ? (f)+0.5 : (f)-0.5) +/*----------------debugging-----------------*/ +volatile int devPM304Debug = 0; +extern "C" {epicsExportAddress(int, devPM304Debug);} -#ifdef __GNUG__ - #ifdef DEBUG - volatile int devPM304Debug = 0; - #define Debug(L, FMT, V...) { if(L <= devPM304Debug) \ - { errlogPrintf("%s(%d):",__FILE__,__LINE__); \ - errlogPrintf(FMT,##V); } } - #else - #define Debug(L, FMT, V...) - #endif -#else - #define Debug() -#endif +static inline void Debug(int level, const char *format, ...) { + #ifdef DEBUG + if (level < devPM304Debug) { + va_list pVar; + va_start(pVar, format); + vprintf(format, pVar); + va_end(pVar); + } + #endif +} /* Debugging levels: diff --git a/motorApp/MclennanSrc/drvPM304.cc b/motorApp/MclennanSrc/drvPM304.cc index ef8d0b46..e7030827 100644 --- a/motorApp/MclennanSrc/drvPM304.cc +++ b/motorApp/MclennanSrc/drvPM304.cc @@ -58,19 +58,20 @@ struct mess_queue struct mess_node *tail; }; - -#ifdef __GNUG__ - #ifdef DEBUG - volatile int drvPM304Debug = 0; - #define Debug(L, FMT, V...) { if(L <= drvPM304Debug) \ - { errlogPrintf("%s(%d):",__FILE__,__LINE__); \ - errlogPrintf(FMT,##V); } } - #else - #define Debug(L, FMT, V...) - #endif -#else - #define Debug() -#endif +/*----------------debugging-----------------*/ +volatile int drvPM304Debug = 0; +extern "C" {epicsExportAddress(int, drvPM304Debug);} + +static inline void Debug(int level, const char *format, ...) { + #ifdef DEBUG + if (level < drvPM304Debug) { + va_list pVar; + va_start(pVar, format); + vprintf(format, pVar); + va_end(pVar); + } + #endif +} /* Debugging notes: * drvPM304Debug == 0 No debugging information is printed diff --git a/motorApp/MicosSrc/devMicos.cc b/motorApp/MicosSrc/devMicos.cc index 97213bea..81e898f3 100644 --- a/motorApp/MicosSrc/devMicos.cc +++ b/motorApp/MicosSrc/devMicos.cc @@ -23,16 +23,19 @@ #include "epicsExport.h" /*----------------debugging-----------------*/ -#ifdef __GNUG__ - #ifdef DEBUG - volatile int devMicosDebug = 0; - #define Debug(l, f, args...) {if (l <= devMicosDebug) printf(f, ## args);} - #else - #define Debug(l, f, args...) - #endif -#else - #define Debug() -#endif +volatile int devMicosDebug = 0; +extern "C" {epicsExportAddress(int, devMicosDebug);} + +static inline void Debug(int level, const char *format, ...) { + #ifdef DEBUG + if (level < devMicosDebug) { + va_list pVar; + va_start(pVar, format); + vprintf(format, pVar); + va_end(pVar); + } + #endif +} /* Debugging levels: * devMicosDebug >= 3 Print new part of command and command string so far diff --git a/motorApp/MicosSrc/drvMicos.cc b/motorApp/MicosSrc/drvMicos.cc index f7cc8fd0..04c0c98b 100644 --- a/motorApp/MicosSrc/drvMicos.cc +++ b/motorApp/MicosSrc/drvMicos.cc @@ -41,18 +41,20 @@ struct mess_queue /*----------------debugging-----------------*/ -#ifdef __GNUG__ - #ifdef DEBUG - #define Debug(l, f, args...) {if (l <= drvMicosDebug) printf(f, ## args);} - #else - #define Debug(l, f, args...) - #endif -#else - #define Debug() -#endif volatile int drvMicosDebug = 0; extern "C" {epicsExportAddress(int, drvMicosDebug);} +static inline void Debug(int level, const char *format, ...) { + #ifdef DEBUG + if (level < drvMicosDebug) { + va_list pVar; + va_start(pVar, format); + vprintf(format, pVar); + va_end(pVar); + } + #endif +} + /* Debugging notes: * drvMicosDebug == 0 No debugging information is printed * drvMicosDebug >= 1 Warning information is printed diff --git a/motorApp/MicroMoSrc/drvMVP2001.cc b/motorApp/MicroMoSrc/drvMVP2001.cc index 1315138d..4cf2063b 100644 --- a/motorApp/MicroMoSrc/drvMVP2001.cc +++ b/motorApp/MicroMoSrc/drvMVP2001.cc @@ -3,9 +3,9 @@ FILENAME... drvMVP2001.cc USAGE... Motor record driver level support for MicroMo MVP 2001 B02 (Linear, RS-485). -Version: $Revision: 1.13 $ -Modified By: $Author: sluiter $ -Last Modified: $Date: 2009-09-08 18:26:32 $ +Version: $Revision$ +Modified By: $Author$ +Last Modified: $Date$ */ /* @@ -136,18 +136,18 @@ MORE DESIGN LIMITATIONS #define BUFF_SIZE 20 /* Maximum length of string to/from MVP2001 */ /*----------------debugging-----------------*/ -#ifdef __GNUG__ - #ifdef DEBUG - #define Debug(l, f, args...) { if(l<=drvMVP2001debug) printf(f,## args); } - #else - #define Debug(l, f, args...) - #endif -#else - #define Debug() -#endif - volatile int drvMVP2001debug = 0; extern "C" {epicsExportAddress(int, drvMVP2001debug);} +static inline void Debug(int level, const char *format, ...) { + #ifdef DEBUG + if (level < drvMVP2001debug) { + va_list pVar; + va_start(pVar, format); + vprintf(format, pVar); + va_end(pVar); + } + #endif +} /* --- Local data. --- */ int MVP2001_num_cards = 0; diff --git a/motorApp/NewFocusSrc/drvPMNC87xx.cc b/motorApp/NewFocusSrc/drvPMNC87xx.cc index 2ee43224..800d51c9 100644 --- a/motorApp/NewFocusSrc/drvPMNC87xx.cc +++ b/motorApp/NewFocusSrc/drvPMNC87xx.cc @@ -110,18 +110,20 @@ Last Modified: 2005/03/30 19:10:48 #define MESS_ERR -1 /*----------------debugging-----------------*/ -#ifdef __GNUG__ - #ifdef DEBUG - #define Debug(l, f, args...) { if(l<=drvPMNC87xxdebug) printf(f,## args); } - #else - #define Debug(l, f, args...) - #endif -#else - #define Debug() -#endif volatile int drvPMNC87xxdebug = 0; extern "C" {epicsExportAddress(int, drvPMNC87xxdebug);} +static inline void Debug(int level, const char *format, ...) { + #ifdef DEBUG + if (level < drvPMNC87xxdebug) { + va_list pVar; + va_start(pVar, format); + vprintf(format, pVar); + va_end(pVar); + } + #endif +} + /* --- Local data. --- */ int PMNC87xx_num_cards = 0; int PMNC87xx_num_drivers = 0; /* Number of Drivers per Controller */ diff --git a/motorApp/NewportSrc/drvESP300.cc b/motorApp/NewportSrc/drvESP300.cc index b80d8f8e..21bccc4e 100644 --- a/motorApp/NewportSrc/drvESP300.cc +++ b/motorApp/NewportSrc/drvESP300.cc @@ -2,9 +2,10 @@ FILENAME... drvESP300.cc USAGE... Motor record driver level support for Newport ESP300/100. -Version: $Revision: 1.25 $ -Modified By: $Author: rivers $ -Last Modified: $Date: 2009-09-01 16:17:46 $ +Version: $Revision$ +Modified By: $Author$ +Last Modified: $Date$ +HeadURL: $URL$ */ /* @@ -75,17 +76,19 @@ Last Modified: $Date: 2009-09-01 16:17:46 $ #define SERIAL_TIMEOUT 5.0 /* Command timeout in sec. */ /*----------------debugging-----------------*/ -#ifdef __GNUG__ - #ifdef DEBUG - #define Debug(l, f, args...) { if(l<=drvESP300debug) printf(f,## args); } - #else - #define Debug(l, f, args...) - #endif -#else - #define Debug() -#endif + volatile int drvESP300debug = 0; extern "C" {epicsExportAddress(int, drvESP300debug);} +static inline void Debug(int level, const char *format, ...) { + #ifdef DEBUG + if (level < drvESP300debug) { + va_list pVar; + va_start(pVar, format); + vprintf(format, pVar); + va_end(pVar); + } + #endif +} int ESP300_num_cards = 0; diff --git a/motorApp/NewportSrc/drvMM3000.cc b/motorApp/NewportSrc/drvMM3000.cc index 1cfd2c05..8675a2cf 100644 --- a/motorApp/NewportSrc/drvMM3000.cc +++ b/motorApp/NewportSrc/drvMM3000.cc @@ -103,17 +103,18 @@ HeadURL: $URL$ #define SERIAL_TIMEOUT 5.0 /* Command timeout in sec. */ /*----------------debugging-----------------*/ -#ifdef __GNUG__ - #ifdef DEBUG - #define Debug(l, f, args...) { if(l<=drvMM3000debug) printf(f,## args); } - #else - #define Debug(l, f, args...) - #endif -#else - #define Debug() -#endif volatile int drvMM3000debug = 0; extern "C" {epicsExportAddress(int, drvMM3000debug);} +static inline void Debug(int level, const char *format, ...) { + #ifdef DEBUG + if (level < drvMM3000debug) { + va_list pVar; + va_start(pVar, format); + vprintf(format, pVar); + va_end(pVar); + } + #endif +} /* --- Local data. --- */ int MM3000_num_cards = 0; diff --git a/motorApp/NewportSrc/drvMM4000.cc b/motorApp/NewportSrc/drvMM4000.cc index ed1b31d4..b106aef3 100644 --- a/motorApp/NewportSrc/drvMM4000.cc +++ b/motorApp/NewportSrc/drvMM4000.cc @@ -116,17 +116,18 @@ HeadURL: $URL$ #define TIMEOUT 2.0 /* Command timeout in sec. */ /*----------------debugging-----------------*/ -#ifdef __GNUG__ - #ifdef DEBUG - #define Debug(l, f, args...) { if(l<=drvMM4000debug) printf(f,## args); } - #else - #define Debug(l, f, args...) - #endif -#else - #define Debug() -#endif volatile int drvMM4000debug = 0; extern "C" {epicsExportAddress(int, drvMM4000debug);} +static inline void Debug(int level, const char *format, ...) { + #ifdef DEBUG + if (level < drvMM4000debug) { + va_list pVar; + va_start(pVar, format); + vprintf(format, pVar); + va_end(pVar); + } + #endif +} /* --- Local data. --- */ int MM4000_num_cards = 0; diff --git a/motorApp/NewportSrc/drvPM500.cc b/motorApp/NewportSrc/drvPM500.cc index 5bf5f1e0..9ae0804b 100644 --- a/motorApp/NewportSrc/drvPM500.cc +++ b/motorApp/NewportSrc/drvPM500.cc @@ -2,9 +2,10 @@ FILENAME... drvPM500.cc USAGE... Motor record driver level support for Newport PM500. -Version: $Revision: 1.22 $ -Modified By: $Author: rivers $ -Last Modified: $Date: 2009-09-01 16:20:08 $ +Version: $Revision$ +Modified By: $Author$ +Last Modified: $Date$ +HeadURL: $URL$ */ /* Device Driver Support routines for PM500 motor controller */ @@ -85,17 +86,18 @@ Last Modified: $Date: 2009-09-01 16:20:08 $ #define SERIAL_TIMEOUT 2.0 /* Command timeout in sec. */ /*----------------debugging-----------------*/ -#ifdef __GNUG__ - #ifdef DEBUG - #define Debug(l, f, args...) { if(l<=drvPM500debug) printf(f,## args); } - #else - #define Debug(l, f, args...) - #endif -#else - #define Debug() -#endif volatile int drvPM500debug = 0; extern "C" {epicsExportAddress(int, drvPM500debug);} +static inline void Debug(int level, const char *format, ...) { + #ifdef DEBUG + if (level < drvPM500debug) { + va_list pVar; + va_start(pVar, format); + vprintf(format, pVar); + va_end(pVar); + } + #endif +} /* --- Local data. --- */ int PM500_num_cards = 0; diff --git a/motorApp/OmsSrc/drvMAXv_trajectory.cc b/motorApp/OmsSrc/drvMAXv_trajectory.cc index 162a033d..60593b64 100644 --- a/motorApp/OmsSrc/drvMAXv_trajectory.cc +++ b/motorApp/OmsSrc/drvMAXv_trajectory.cc @@ -2,10 +2,10 @@ FILENAME... drvMAXv.cc USAGE... Motor record driver level support for OMS model MAXv. -Version: $Revision: 11147 $ -Modified By: $Author: sluiter $ -Last Modified: $Date: 2010-06-09 13:43:20 -0500 (Wed, 09 Jun 2010) $ -HeadURL: $URL: https://subversion.xor.aps.anl.gov/synApps/motor/trunk/motorApp/OmsSrc/drvMAXv.cc $ +Version: $Revision$ +Modified By: $Author$ +Last Modified: $Date$ +HeadURL: $URL$ */ /* This is a customized version of drvMAXv.cc with modifications to support @@ -137,18 +137,18 @@ struct MAXv_DevicePrivate { /*----------------debugging-----------------*/ -#ifdef __GNUG__ - #ifdef DEBUG - #define Debug(l, f, args...) {if (l <= drvMAXvdebug) \ - errlogPrintf(f, ## args);} - #else - #define Debug(l, f, args...) - #endif -#else - #define Debug -#endif volatile int drvMAXvdebug = 0; extern "C" {epicsExportAddress(int, drvMAXvdebug);} +static inline void Debug(int level, const char *format, ...) { + #ifdef DEBUG + if (level < drvMAXvdebug) { + va_list pVar; + va_start(pVar, format); + vprintf(format, pVar); + va_end(pVar); + } + #endif +} #define pack2x16(p) ((epicsUInt32)(((p[0])<<16)|(p[1]))) #define INITSTR_SIZE 300 /* 300 byte configuration string. */ diff --git a/motorApp/OmsSrc/drvOms.cc b/motorApp/OmsSrc/drvOms.cc index bdaa0c6b..972b2312 100644 --- a/motorApp/OmsSrc/drvOms.cc +++ b/motorApp/OmsSrc/drvOms.cc @@ -125,18 +125,18 @@ HeadURL: $URL$ #define DONE_QUERY "RA" /*----------------debugging-----------------*/ -#ifdef __GNUG__ - #ifdef DEBUG - #define Debug(l, f, args...) {if (l <= drvOMSdebug) \ - errlogPrintf(f, ## args);} - #else - #define Debug(l, f, args...) - #endif -#else - #define Debug -#endif volatile int drvOMSdebug = 0; extern "C" {epicsExportAddress(int, drvOMSdebug);} +static inline void Debug(int level, const char *format, ...) { + #ifdef DEBUG + if (level < drvOMSdebug) { + va_list pVar; + va_start(pVar, format); + vprintf(format, pVar); + va_end(pVar); + } + #endif +} /* Global data. */ int oms44_num_cards = 0; diff --git a/motorApp/OmsSrc/drvOms58.cc b/motorApp/OmsSrc/drvOms58.cc index b9a2e91b..93a6448f 100644 --- a/motorApp/OmsSrc/drvOms58.cc +++ b/motorApp/OmsSrc/drvOms58.cc @@ -151,18 +151,18 @@ HeadURL: $URL$ /*----------------debugging-----------------*/ -#ifdef __GNUG__ - #ifdef DEBUG - #define Debug(l, f, args...) {if (l <= drvOms58debug) \ - errlogPrintf(f, ## args);} - #else - #define Debug(l, f, args...) - #endif -#else - #define Debug -#endif volatile int drvOms58debug = 0; extern "C" {epicsExportAddress(int, drvOms58debug);} +static inline void Debug(int level, const char *format, ...) { + #ifdef DEBUG + if (level < drvOms58debug) { + va_list pVar; + va_start(pVar, format); + vprintf(format, pVar); + va_end(pVar); + } + #endif +} #define pack2x16(p) ((epicsUInt32)(((p[0])<<16)|(p[1]))) diff --git a/motorApp/OmsSrc/drvOmsPC68.cc b/motorApp/OmsSrc/drvOmsPC68.cc index 384a8010..44f30892 100644 --- a/motorApp/OmsSrc/drvOmsPC68.cc +++ b/motorApp/OmsSrc/drvOmsPC68.cc @@ -86,19 +86,18 @@ Last Modified: $Date$ #define TIMEOUT (2.0) /* Command timeout in sec. */ /*----------------debugging-----------------*/ -#ifdef __GNUG__ - #ifdef DEBUG - #define Debug(l, f, args...) {if(l<=drvOmsPC68debug) printf(f,## args);} - #else - #define Debug(l, f, args...) - #endif -#else - #define Debug() -#endif - volatile int drvOmsPC68debug = 0; - extern "C" {epicsExportAddress(int, drvOmsPC68debug);} +static inline void Debug(int level, const char *format, ...) { + #ifdef DEBUG + if (level < drvOmsPC68debug) { + va_list pVar; + va_start(pVar, format); + vprintf(format, pVar); + va_end(pVar); + } + #endif +} /* --- Global data. --- */ int OmsPC68_num_cards = 0; diff --git a/motorApp/OrielSrc/drvEMC18011.cc b/motorApp/OrielSrc/drvEMC18011.cc index 3d5a93b4..c4abe237 100644 --- a/motorApp/OrielSrc/drvEMC18011.cc +++ b/motorApp/OrielSrc/drvEMC18011.cc @@ -3,10 +3,10 @@ FILENAME... drvEMC18011.cc USAGE... Motor record driver level support for Spectra-Physics Encoder Mike Controller (Model: 18011) -Version: $Revision: 1.4 $ -Modified By: $Author: sluiter $ -Last Modified: $Date: 2009-09-08 18:28:23 $ - +Version: $Revision$ +Modified By: $Author$ +Last Modified: $Date$ +HeadURL: $URL$ */ /* @@ -74,17 +74,18 @@ Last Modified: $Date: 2009-09-08 18:28:23 $ #define MOTION_DELAY 0.1 /*----------------debugging-----------------*/ -#ifdef __GNUG__ - #ifdef DEBUG - #define Debug(l, f, args...) { if(l<=drvEMC18011debug) printf(f,## args); } - #else - #define Debug(l, f, args...) - #endif -#else - #define Debug() -#endif volatile int drvEMC18011debug = 0; extern "C" {epicsExportAddress(int, drvEMC18011debug);} +static inline void Debug(int level, const char *format, ...) { + #ifdef DEBUG + if (level < drvEMC18011debug) { + va_list pVar; + va_start(pVar, format); + vprintf(format, pVar); + va_end(pVar); + } + #endif +} /* --- Local data. --- */ int EMC18011_num_cards = 0; diff --git a/motorApp/PC6KSrc/drvPC6K.cc b/motorApp/PC6KSrc/drvPC6K.cc index ddc0a414..acc3c28c 100644 --- a/motorApp/PC6KSrc/drvPC6K.cc +++ b/motorApp/PC6KSrc/drvPC6K.cc @@ -3,10 +3,10 @@ FILENAME... drvPC6K.cc USAGE... Motor record driver level support for Parker Computmotor 6K Series motor controllers -Version: $Revision: 1.6 $ -Modified By: $Author: sluiter $ -Last Modified: $Date: 2009-09-08 18:28:46 $ - +Version: $Revision$ +Modified By: $Author$ +Last Modified: $Date$ +HeadURL: $URL$ */ /* @@ -92,17 +92,18 @@ Last Modified: $Date: 2009-09-08 18:28:46 $ #define MOTION_DELAY 0.05 /*----------------debugging-----------------*/ -#ifdef __GNUG__ - #ifdef DEBUG - #define Debug(l, f, args...) { if(l<=drvPC6Kdebug) printf(f,## args); } - #else - #define Debug(l, f, args...) - #endif -#else - #define Debug() -#endif volatile int drvPC6Kdebug = 0; extern "C" {epicsExportAddress(int, drvPC6Kdebug);} +static inline void Debug(int level, const char *format, ...) { + #ifdef DEBUG + if (level < drvPC6Kdebug) { + va_list pVar; + va_start(pVar, format); + vprintf(format, pVar); + va_end(pVar); + } + #endif +} /* --- Local data. --- */ int PC6K_num_cards = 0; diff --git a/motorApp/PiJenaSrc/drvPIJEDS.cc b/motorApp/PiJenaSrc/drvPIJEDS.cc index 89729da7..d559d7a5 100644 --- a/motorApp/PiJenaSrc/drvPIJEDS.cc +++ b/motorApp/PiJenaSrc/drvPIJEDS.cc @@ -3,10 +3,10 @@ FILENAME... drvPIJEDS.cc USAGE... Motor record driver level support for piezosystem jena GmbH & Co. E-516 motor controller. -Version: $Revision: 1.2 $ -Modified By: $Author: sluiter $ -Last Modified: $Date: 2009-09-08 18:29:06 $ -*/ +Version: $Revision$ +Modified By: $Author$ +Last Modified: $Date$ +HeadURL: $URL$*/ /* * Original Author: Joe Sullivan @@ -58,17 +58,18 @@ DESIGN LIMITATIONS... #define BUFF_SIZE 100 /* Maximum length of string to/from PIJEDS */ /*----------------debugging-----------------*/ -#ifdef __GNUG__ - #ifdef DEBUG - #define Debug(l, f, args...) { if(l<=drvPIJEDSdebug) printf(f,## args); } - #else - #define Debug(l, f, args...) - #endif -#else - #define Debug() -#endif volatile int drvPIJEDSdebug = 0; extern "C" {epicsExportAddress(int, drvPIJEDSdebug);} +static inline void Debug(int level, const char *format, ...) { + #ifdef DEBUG + if (level < drvPIJEDSdebug) { + va_list pVar; + va_start(pVar, format); + vprintf(format, pVar); + va_end(pVar); + } + #endif +} /* --- Local data. --- */ int PIJEDS_num_cards = 0; diff --git a/motorApp/PiSrc/devPIC630.cc b/motorApp/PiSrc/devPIC630.cc index ba9ca67b..b4b04707 100644 --- a/motorApp/PiSrc/devPIC630.cc +++ b/motorApp/PiSrc/devPIC630.cc @@ -28,18 +28,18 @@ #define NINT(f) (long)((f)>0 ? (f)+0.5 : (f)-0.5) /*----------------debugging-----------------*/ -#ifdef __GNUG__ - #ifdef DEBUG - volatile int devPIC630debug = 0; - #define Debug(L, FMT, V...) { if(L <= devPIC630debug) \ - { errlogPrintf("%s(%d):",__FILE__,__LINE__); \ - errlogPrintf(FMT,##V); } } - #else - #define Debug(L, FMT, V...) - #endif -#else - #define Debug() -#endif +volatile int devPIC630debug = 0; +extern "C" {epicsExportAddress(int, devPIC630debug);} +static inline void Debug(int level, const char *format, ...) { + #ifdef DEBUG + if (level < devPIC630debug) { + va_list pVar; + va_start(pVar, format); + vprintf(format, pVar); + va_end(pVar); + } + #endif +} /* Debugging levels: * devPIC630debug >= 3 Print new part of command and command string so far diff --git a/motorApp/PiSrc/drvPIC630.cc b/motorApp/PiSrc/drvPIC630.cc index 05ffc6ad..a01bbeb0 100644 --- a/motorApp/PiSrc/drvPIC630.cc +++ b/motorApp/PiSrc/drvPIC630.cc @@ -31,17 +31,18 @@ #define BUFF_SIZE 100 /* Maximum length of string to/from PIC630 */ /*----------------debugging-----------------*/ -#ifdef __GNUG__ - #ifdef DEBUG - #define Debug(l, f, args...) { if(l<=drvPIC630debug) printf(f,## args); } - #else - #define Debug(l, f, args...) - #endif -#else - #define Debug() -#endif volatile int drvPIC630debug = 0; extern "C" {epicsExportAddress(int, drvPIC630debug);} +static inline void Debug(int level, const char *format, ...) { + #ifdef DEBUG + if (level < drvPIC630debug) { + va_list pVar; + va_start(pVar, format); + vprintf(format, pVar); + va_end(pVar); + } + #endif +} /* Debugging notes: * drvPIC630debug == 0 No debugging information is printed diff --git a/motorApp/PiSrc/drvPIC662.cc b/motorApp/PiSrc/drvPIC662.cc index 80f69322..1a3b175e 100644 --- a/motorApp/PiSrc/drvPIC662.cc +++ b/motorApp/PiSrc/drvPIC662.cc @@ -64,17 +64,18 @@ DESIGN LIMITATIONS... #define BUFF_SIZE 100 /* Maximum length of string to/from PIC662 */ /*----------------debugging-----------------*/ -#ifdef __GNUG__ - #ifdef DEBUG - #define Debug(l, f, args...) { if(l<=drvPIC662debug) printf(f,## args); } - #else - #define Debug(l, f, args...) - #endif -#else - #define Debug() -#endif volatile int drvPIC662debug = 0; extern "C" {epicsExportAddress(int, drvPIC662debug);} +static inline void Debug(int level, const char *format, ...) { + #ifdef DEBUG + if (level < drvPIC662debug) { + va_list pVar; + va_start(pVar, format); + vprintf(format, pVar); + va_end(pVar); + } + #endif +} /* --- Local data. --- */ int PIC662_num_cards = 0; diff --git a/motorApp/PiSrc/drvPIC663.cc b/motorApp/PiSrc/drvPIC663.cc index 9519416a..666130f9 100644 --- a/motorApp/PiSrc/drvPIC663.cc +++ b/motorApp/PiSrc/drvPIC663.cc @@ -34,17 +34,18 @@ DESIGN LIMITATIONS... #define BUFF_SIZE 100 /* Maximum length of string to/from PIC663 */ /*----------------debugging-----------------*/ -#ifdef __GNUG__ - #ifdef DEBUG - #define Debug(l, f, args...) { if(l<=drvPIC663debug) printf(f,## args); } - #else - #define Debug(l, f, args...) - #endif -#else - #define Debug() -#endif volatile int drvPIC663debug = 0; extern "C" {epicsExportAddress(int, drvPIC663debug);} +static inline void Debug(int level, const char *format, ...) { + #ifdef DEBUG + if (level < drvPIC663debug) { + va_list pVar; + va_start(pVar, format); + vprintf(format, pVar); + va_end(pVar); + } + #endif +} /* --- Local data. --- */ int PIC663_num_cards = 0; diff --git a/motorApp/PiSrc/drvPIC844.cc b/motorApp/PiSrc/drvPIC844.cc index b9506866..0de16bab 100644 --- a/motorApp/PiSrc/drvPIC844.cc +++ b/motorApp/PiSrc/drvPIC844.cc @@ -72,17 +72,18 @@ DESIGN LIMITATIONS... #define BUFF_SIZE 100 /* Maximum length of string to/from PIC844 */ /*----------------debugging-----------------*/ -#ifdef __GNUG__ - #ifdef DEBUG - #define Debug(l, f, args...) { if(l<=drvPIC844debug) printf(f,## args); } - #else - #define Debug(l, f, args...) - #endif -#else - #define Debug() -#endif volatile int drvPIC844debug = 0; extern "C" {epicsExportAddress(int, drvPIC844debug);} +static inline void Debug(int level, const char *format, ...) { + #ifdef DEBUG + if (level < drvPIC844debug) { + va_list pVar; + va_start(pVar, format); + vprintf(format, pVar); + va_end(pVar); + } + #endif +} /* --- Local data. --- */ int PIC844_num_cards = 0; diff --git a/motorApp/PiSrc/drvPIC862.cc b/motorApp/PiSrc/drvPIC862.cc index 3ed519a2..a650f4ec 100644 --- a/motorApp/PiSrc/drvPIC862.cc +++ b/motorApp/PiSrc/drvPIC862.cc @@ -43,17 +43,18 @@ DESIGN LIMITATIONS... #define BUFF_SIZE 100 /* Maximum length of string to/from PIC862 */ /*----------------debugging-----------------*/ -#ifdef __GNUG__ - #ifdef DEBUG - #define Debug(l, f, args...) { if(l<=drvPIC862debug) printf(f,## args); } - #else - #define Debug(l, f, args...) - #endif -#else - #define Debug() -#endif volatile int drvPIC862debug = 0; extern "C" {epicsExportAddress(int, drvPIC862debug);} +static inline void Debug(int level, const char *format, ...) { + #ifdef DEBUG + if (level < drvPIC862debug) { + va_list pVar; + va_start(pVar, format); + vprintf(format, pVar); + va_end(pVar); + } + #endif +} /* --- Local data. --- */ int PIC862_num_cards = 0; diff --git a/motorApp/PiSrc/drvPIE516.cc b/motorApp/PiSrc/drvPIE516.cc index f1e65d0a..d8f8be50 100644 --- a/motorApp/PiSrc/drvPIE516.cc +++ b/motorApp/PiSrc/drvPIE516.cc @@ -68,17 +68,18 @@ DESIGN LIMITATIONS... #define BUFF_SIZE 100 /* Maximum length of string to/from PIE516 */ /*----------------debugging-----------------*/ -#ifdef __GNUG__ - #ifdef DEBUG - #define Debug(l, f, args...) { if(l<=drvPIE516debug) printf(f,## args); } - #else - #define Debug(l, f, args...) - #endif -#else - #define Debug() -#endif volatile int drvPIE516debug = 0; extern "C" {epicsExportAddress(int, drvPIE516debug);} +static inline void Debug(int level, const char *format, ...) { + #ifdef DEBUG + if (level < drvPIE516debug) { + va_list pVar; + va_start(pVar, format); + vprintf(format, pVar); + va_end(pVar); + } + #endif +} /* --- Local data. --- */ int PIE516_num_cards = 0; diff --git a/motorApp/PiSrc/drvPIE710.cc b/motorApp/PiSrc/drvPIE710.cc index 434340b2..3fd920c2 100644 --- a/motorApp/PiSrc/drvPIE710.cc +++ b/motorApp/PiSrc/drvPIE710.cc @@ -60,17 +60,18 @@ DESIGN LIMITATIONS... #define BUFF_SIZE 100 /* Maximum length of string to/from PIE710 */ /*----------------debugging-----------------*/ -#ifdef __GNUG__ - #ifdef DEBUG - #define Debug(l, f, args...) { if(l<=drvPIE710debug) printf(f,## args); } - #else - #define Debug(l, f, args...) - #endif -#else - #define Debug() -#endif volatile int drvPIE710debug = 0; extern "C" {epicsExportAddress(int, drvPIE710debug);} +static inline void Debug(int level, const char *format, ...) { + #ifdef DEBUG + if (level < drvPIE710debug) { + va_list pVar; + va_start(pVar, format); + vprintf(format, pVar); + va_end(pVar); + } + #endif +} /* --- Local data. --- */ int PIE710_num_cards = 0; diff --git a/motorApp/SmartMotorSrc/drvSmartMotor.cc b/motorApp/SmartMotorSrc/drvSmartMotor.cc index 1bc97278..acfbebfa 100644 --- a/motorApp/SmartMotorSrc/drvSmartMotor.cc +++ b/motorApp/SmartMotorSrc/drvSmartMotor.cc @@ -59,19 +59,17 @@ Last Modified: $Date: 2007-09-13 16:36:38 $ #define BUFF_SIZE 20 /* Maximum length of string to/from SmartMotor */ /*----------------debugging-----------------*/ -#ifdef __GNUG__ - #ifdef DEBUG - #define Debug(l, f, args...) {if (l <= drvSmartMotordebug) printf(f, ## args);} - #else - #define Debug(l, f, args...) - #endif -#else - #define Debug() -#endif volatile int drvSmartMotordebug = 0; -extern "C" -{ - epicsExportAddress(int, drvSmartMotordebug); +extern "C" {epicsExportAddress(int, drvSmartMotordebug);} +static inline void Debug(int level, const char *format, ...) { + #ifdef DEBUG + if (level < drvSmartMotordebug) { + va_list pVar; + va_start(pVar, format); + vprintf(format, pVar); + va_end(pVar); + } + #endif } /* --- Local data. --- */ diff --git a/motorApp/SoftMotorSrc/devSoft.cc b/motorApp/SoftMotorSrc/devSoft.cc index 288a6781..017fde5f 100644 --- a/motorApp/SoftMotorSrc/devSoft.cc +++ b/motorApp/SoftMotorSrc/devSoft.cc @@ -66,18 +66,18 @@ NOTES... #include "errlog.h" /*----------------debugging-----------------*/ -#ifdef __GNUG__ - #ifdef DEBUG - #define Debug(l, f, args...) {if (l <= devSoftdebug) \ - errlogPrintf(f, ## args);} - #else - #define Debug(l, f, args...) - #endif -#else - #define Debug -#endif volatile int devSoftdebug = 0; extern "C" {epicsExportAddress(int, devSoftdebug);} +static inline void Debug(int level, const char *format, ...) { + #ifdef DEBUG + if (level < devSoftdebug) { + va_list pVar; + va_start(pVar, format); + vprintf(format, pVar); + va_end(pVar); + } + #endif +} static CALLBACK_VALUE update(struct motorRecord *); static long start(struct motorRecord *); diff --git a/motorApp/ThorLabsSrc/drvMDT695.cc b/motorApp/ThorLabsSrc/drvMDT695.cc index 3b231dbd..ad9c7aba 100644 --- a/motorApp/ThorLabsSrc/drvMDT695.cc +++ b/motorApp/ThorLabsSrc/drvMDT695.cc @@ -68,17 +68,18 @@ Last Modified: $Date: 2009-09-08 18:36:20 $ #define MOTION_DELAY 0.1 /*----------------debugging-----------------*/ -#ifdef __GNUG__ - #ifdef DEBUG - #define Debug(l, f, args...) { if(l<=drvMDT695debug) printf(f,## args); } - #else - #define Debug(l, f, args...) - #endif -#else - #define Debug() -#endif volatile int drvMDT695debug = 0; extern "C" {epicsExportAddress(int, drvMDT695debug);} +static inline void Debug(int level, const char *format, ...) { + #ifdef DEBUG + if (level < drvMDT695debug) { + va_list pVar; + va_start(pVar, format); + vprintf(format, pVar); + va_end(pVar); + } + #endif +} /* --- Local data. --- */ int MDT695_num_cards = 0;