AP_Menu: allow to use functor

This commit is contained in:
Lucas De Marchi 2015-05-24 18:55:06 -03:00 committed by Andrew Tridgell
parent 4b5cf24a81
commit 70525fa2c1

View File

@ -56,7 +56,9 @@ public:
/// command, so that the same function can be used
/// to handle more than one command.
///
#if APM_BUILD_DELEGATES
#if APM_BUILD_FUNCTOR
FUNCTOR_TYPEDEF(func, int8_t, uint8_t, const struct arg *);
#elif APM_BUILD_DELEGATES
typedef DELEGATE_FUNCTION2(int8_t, uint8_t, const struct arg *) func;
#else
typedef int8_t (*func)(uint8_t argc, const struct arg *argv);
@ -73,7 +75,9 @@ public:
///
/// If this function returns false, the menu exits.
///
#if APM_BUILD_DELEGATES
#if APM_BUILD_FUNCTOR
FUNCTOR_TYPEDEF(preprompt, bool);
#elif APM_BUILD_DELEGATES
typedef DELEGATE_FUNCTION0(bool) preprompt;
#else
typedef bool (*preprompt)(void);
@ -98,7 +102,9 @@ public:
/// The "?", "help" and "exit" commands are always defined, but
/// can be overridden by explicit entries in the command array.
///
#if APM_BUILD_DELEGATES
#if APM_BUILD_FUNCTOR
FUNCTOR_DECLARE(func, int8_t, uint8_t, const struct arg *);
#elif APM_BUILD_DELEGATES
DELEGATE_FUNCTION2(int8_t, uint8_t, const struct arg *) func;
#else
int8_t (*func)(uint8_t argc, const struct arg *argv);