From 9ed57211cc684d5135a254d9230c6d82bb092f9b Mon Sep 17 00:00:00 2001 From: Thomas Gubler Date: Wed, 10 Dec 2014 12:40:36 +0100 Subject: [PATCH] hack to define isspace in px4_defines, add macro for subscription without callback --- src/platforms/px4_defines.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/platforms/px4_defines.h b/src/platforms/px4_defines.h index ff302448a5..283dc5a53c 100644 --- a/src/platforms/px4_defines.h +++ b/src/platforms/px4_defines.h @@ -96,6 +96,9 @@ static inline px4_param_t PX4_ROS_PARAM_SET(const char *name, float value) * Building for NuttX */ #include +#ifdef __cplusplus +#include +#endif /* Main entry point */ #define PX4_MAIN_FUNCTION(_prefix) extern "C" __EXPORT int _prefix##_main(int argc, char *argv[]) @@ -113,6 +116,7 @@ static inline px4_param_t PX4_ROS_PARAM_SET(const char *name, float value) #define PX4_SUBSCRIBE_CBMETH(_nodehandle, _name, _cbf, _obj, _interval) _nodehandle.subscribe(PX4_TOPIC(_name), std::bind(&_cbf, _obj, std::placeholders::_1), _interval) /* Subscribe and providing a function as callback (do not use directly, use PX4_SUBSCRIBE instead) */ #define PX4_SUBSCRIBE_CBFUNC(_nodehandle, _name, _cbf, _interval) _nodehandle.subscribe(PX4_TOPIC(_name), std::bind(&_cbf, std::placeholders::_1), _interval) +#define PX4_SUBSCRIBE_NOCB(_nodehandle, _name, _interval) _nodehandle.subscribe(PX4_TOPIC(_name), nullptr, _interval) /* Parameter handle datatype */ #include @@ -126,10 +130,10 @@ typedef param_t px4_param_t; #endif /* Shortcut for subscribing to topics - * Overload the PX4_SUBSCRIBE macro to suppport methods and pure functions as callback + * Overload the PX4_SUBSCRIBE macro to suppport methods, pure functions as callback and no callback at all */ #define PX4_GET_SUBSCRIBE(_1, _2, _3, _4, _5, NAME, ...) NAME -#define PX4_SUBSCRIBE(...) PX4_GET_SUBSCRIBE(__VA_ARGS__, PX4_SUBSCRIBE_CBMETH, PX4_SUBSCRIBE_CBFUNC)(__VA_ARGS__) +#define PX4_SUBSCRIBE(...) PX4_GET_SUBSCRIBE(__VA_ARGS__, PX4_SUBSCRIBE_CBMETH, PX4_SUBSCRIBE_CBFUNC, PX4_SUBSCRIBE_NOCB)(__VA_ARGS__) /* shortcut for advertising topics */ #define PX4_ADVERTISE(_nodehandle, _name) _nodehandle.advertise(PX4_TOPIC(_name)) @@ -139,3 +143,7 @@ typedef param_t px4_param_t; /* wrapper for rotation matrices stored in arrays */ #define PX4_R(_array, _x, _y) PX4_ARRAY2D(_array, 3, _x, _y) + +#define isspace(c) \ + ((c) == ' ' || (c) == '\t' || (c) == '\n' || \ + (c) == '\r' || (c) == '\f' || c== '\v')