diff --git a/.github/workflows/aunit_tests.yml b/.github/workflows/aunit_tests.yml index 76d7b59..bd2ff57 100644 --- a/.github/workflows/aunit_tests.yml +++ b/.github/workflows/aunit_tests.yml @@ -13,7 +13,7 @@ jobs: - name: Setup run: | cd .. - git clone https://github.com/bxparks/UnixHostDuino + git clone https://github.com/bxparks/EpoxyDuino git clone https://github.com/bxparks/AUnit git clone https://github.com/bxparks/AceCommon git clone https://github.com/bxparks/AceRoutine diff --git a/CHANGELOG.md b/CHANGELOG.md index 10305e0..6d90ca7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,13 @@ # Changelog * Unreleased +* 0.4.1 (2021-01-22) + * Convert `SHIFT_ARGC_ARGV()` macro in `src/cli/CommandHandler.h` to + an inlined static function `CommandHandler::shiftArgcArgv()` using + references. I forgot that I was programming in C++ when I created the + macro. Add `SHIFT_ARGC_ARGV()` function for backwards compatibility. + * Update UnixHostDuino 0.4 to EpoxyDuino 0.5. + * No functional change in this release. * 0.4 (2020-12-09) * update `AceUtilsCrcEeprom.h` * Replace FastCRC with AceCRC library for a reduction of 4-5 kB of flash diff --git a/README.md b/README.md index a47d7e1..97a1fe9 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ AceTime, AceRoutine, etc) or third party libraries. * Depends on: * (none) -**Version**: 0.4 (2020-12-09) +**Version**: 0.4.1 (2021-01-22) **Changelog**: [CHANGELOG.md](CHANGELOG.md) @@ -115,7 +115,7 @@ It should work with [PlatformIO](https://platformio.org/) but I have not tested it. Many utilities work on Linux or MacOS (using both g++ and clang++ compilers) -using the [UnixHostDuino](https://github.com/bxparks/UnixHostDuino) emulation +using the [EpoxyDuino](https://github.com/bxparks/EpoxyDuino) emulation layer. ### Operating System diff --git a/docs/doxygen.cfg b/docs/doxygen.cfg index 1f5c41d..cdeee53 100644 --- a/docs/doxygen.cfg +++ b/docs/doxygen.cfg @@ -38,7 +38,7 @@ PROJECT_NAME = "AceUtils" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 0.4 +PROJECT_NUMBER = 0.4.1 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/docs/html/AceUtilsCli_8h_source.html b/docs/html/AceUtilsCli_8h_source.html index bd392d3..800c14a 100644 --- a/docs/html/AceUtilsCli_8h_source.html +++ b/docs/html/AceUtilsCli_8h_source.html @@ -22,7 +22,7 @@
AceUtils -  0.4 +  0.4.1
Useful Arduino utilties which are too small as separate libraries, but complex enough to be shared among multiple projects, and often have external dependencies to other libraries.
diff --git a/docs/html/AceUtilsCrcEeprom_8h_source.html b/docs/html/AceUtilsCrcEeprom_8h_source.html index 75935d0..02b24cf 100644 --- a/docs/html/AceUtilsCrcEeprom_8h_source.html +++ b/docs/html/AceUtilsCrcEeprom_8h_source.html @@ -22,7 +22,7 @@
AceUtils -  0.4 +  0.4.1
Useful Arduino utilties which are too small as separate libraries, but complex enough to be shared among multiple projects, and often have external dependencies to other libraries.
diff --git a/docs/html/AceUtilsModeGroup_8h_source.html b/docs/html/AceUtilsModeGroup_8h_source.html index 13aa68d..c14da45 100644 --- a/docs/html/AceUtilsModeGroup_8h_source.html +++ b/docs/html/AceUtilsModeGroup_8h_source.html @@ -22,7 +22,7 @@
AceUtils -  0.4 +  0.4.1
Useful Arduino utilties which are too small as separate libraries, but complex enough to be shared among multiple projects, and often have external dependencies to other libraries.
diff --git a/docs/html/AceUtils_8h_source.html b/docs/html/AceUtils_8h_source.html index f6d22c3..5b67b82 100644 --- a/docs/html/AceUtils_8h_source.html +++ b/docs/html/AceUtils_8h_source.html @@ -22,7 +22,7 @@
AceUtils -  0.4 +  0.4.1
Useful Arduino utilties which are too small as separate libraries, but complex enough to be shared among multiple projects, and often have external dependencies to other libraries.
diff --git a/docs/html/CommandDispatcher_8cpp_source.html b/docs/html/CommandDispatcher_8cpp_source.html index 2b75575..a813eb4 100644 --- a/docs/html/CommandDispatcher_8cpp_source.html +++ b/docs/html/CommandDispatcher_8cpp_source.html @@ -22,7 +22,7 @@
AceUtils -  0.4 +  0.4.1
Useful Arduino utilties which are too small as separate libraries, but complex enough to be shared among multiple projects, and often have external dependencies to other libraries.
@@ -207,12 +207,12 @@
134 } // cli
135 } // ace_utils
-
ace_utils::cli::CommandHandler::getName
ace_common::FCString getName() const
Return the name of the command.
Definition: CommandHandler.h:68
-
ace_utils::cli::CommandHandler
Signature for a command handler.
Definition: CommandHandler.h:47
+
ace_utils::cli::CommandHandler::getName
ace_common::FCString getName() const
Return the name of the command.
Definition: CommandHandler.h:59
+
ace_utils::cli::CommandHandler
Signature for a command handler.
Definition: CommandHandler.h:38
ace_utils::cli::CommandDispatcher::findAndRunCommand
void findAndRunCommand(const char *cmd, int argc, const char *const *argv) const
Find and run the given command.
Definition: CommandDispatcher.cpp:122
ace_utils::cli::CommandDispatcher::runCommand
void runCommand(char *line) const
Tokenize the given line and run the command handler.
Definition: CommandDispatcher.cpp:107
ace_utils::cli::CommandDispatcher::printHelp
static void printHelp(Print &printer, const CommandHandler *command)
Print help string for the given command.
Definition: CommandDispatcher.cpp:95
-
ace_utils::cli::CommandHandler::getHelpString
ace_common::FCString getHelpString() const
Return the help string of the command.
Definition: CommandHandler.h:71
+
ace_utils::cli::CommandHandler::getHelpString
ace_common::FCString getHelpString() const
Return the help string of the command.
Definition: CommandHandler.h:62
ace_utils::cli::CommandDispatcher::helpCommandHandler
void helpCommandHandler(Print &printer, int argc, const char *const *argv) const
Handle the 'help' command.
Definition: CommandDispatcher.cpp:55
ace_utils::cli::CommandDispatcher::helpAll
void helpAll(Print &printer) const
Print help on all commands.
Definition: CommandDispatcher.cpp:77
ace_utils::cli::CommandHandler::run
virtual void run(Print &printer, int argc, const char *const *argv) const =0
Run the command.
diff --git a/docs/html/CommandDispatcher_8h_source.html b/docs/html/CommandDispatcher_8h_source.html index 5c0ddfa..2e8d926 100644 --- a/docs/html/CommandDispatcher_8h_source.html +++ b/docs/html/CommandDispatcher_8h_source.html @@ -22,7 +22,7 @@
AceUtils -  0.4 +  0.4.1
Useful Arduino utilties which are too small as separate libraries, but complex enough to be shared among multiple projects, and often have external dependencies to other libraries.
@@ -210,8 +210,8 @@
190 #endif
ace_utils::cli::InputLine
Message sent from StreamLineReader to CommandDispatcher coroutines through Channel<InputLine> channel...
Definition: InputLine.h:36
-
ace_utils::cli::CommandHandler::getName
ace_common::FCString getName() const
Return the name of the command.
Definition: CommandHandler.h:68
-
ace_utils::cli::CommandHandler
Signature for a command handler.
Definition: CommandHandler.h:47
+
ace_utils::cli::CommandHandler::getName
ace_common::FCString getName() const
Return the name of the command.
Definition: CommandHandler.h:59
+
ace_utils::cli::CommandHandler
Signature for a command handler.
Definition: CommandHandler.h:38
ace_utils::cli::CommandDispatcher::findAndRunCommand
void findAndRunCommand(const char *cmd, int argc, const char *const *argv) const
Find and run the given command.
Definition: CommandDispatcher.cpp:122
ace_utils::cli::CommandDispatcher::runCommand
void runCommand(char *line) const
Tokenize the given line and run the command handler.
Definition: CommandDispatcher.cpp:107
ace_utils::cli::CommandDispatcher::printHelp
static void printHelp(Print &printer, const CommandHandler *command)
Print help string for the given command.
Definition: CommandDispatcher.cpp:95
diff --git a/docs/html/CommandHandler_8h_source.html b/docs/html/CommandHandler_8h_source.html index 05df59f..c514ea7 100644 --- a/docs/html/CommandHandler_8h_source.html +++ b/docs/html/CommandHandler_8h_source.html @@ -22,7 +22,7 @@
AceUtils -  0.4 +  0.4.1
Useful Arduino utilties which are too small as separate libraries, but complex enough to be shared among multiple projects, and often have external dependencies to other libraries.
@@ -102,56 +102,65 @@
29 
30 class Print;
31 
-
39 #define SHIFT_ARGC_ARGV(argc, argv) do { argc--; argv++; } while (false)
-
40 
-
41 namespace ace_utils {
-
42 namespace cli {
-
43 
-
47 class CommandHandler {
-
48  public:
-
64  virtual void run(Print& printer, int argc, const char* const* argv)
-
65  const = 0;
-
66 
-
68  ace_common::FCString getName() const { return mName; }
-
69 
-
71  ace_common::FCString getHelpString() const { return mHelpString; }
-
72 
-
73  protected:
-
75  static bool isArgEqual(const char* arg, const char* token) {
-
76  return strcmp(arg, token) == 0;
-
77  }
-
78 
-
80  static bool isArgEqual(const char* arg, const __FlashStringHelper* token) {
-
81  return strcmp_P(arg, (const char*) token) == 0;
-
82  }
-
83 
-
85  CommandHandler(const char* name, const char* helpString):
-
86  mName(name),
-
87  mHelpString(helpString) {}
-
88 
-
90  CommandHandler(const __FlashStringHelper* name,
-
91  const __FlashStringHelper* helpString):
-
92  mName(name),
-
93  mHelpString(helpString) {}
-
94 
-
95  private:
-
96  ace_common::FCString const mName;
-
97  ace_common::FCString const mHelpString;
-
98 };
-
99 
-
100 } // cli
-
101 } // ace_utils
+
32 namespace ace_utils {
+
33 namespace cli {
+
34 
+
38 class CommandHandler {
+
39  public:
+
55  virtual void run(Print& printer, int argc, const char* const* argv)
+
56  const = 0;
+
57 
+
59  ace_common::FCString getName() const { return mName; }
+
60 
+
62  ace_common::FCString getHelpString() const { return mHelpString; }
+
63 
+
64  protected:
+
72  static void shiftArgcArgv(int& argc, const char* const*& argv) {
+
73  argc--;
+
74  argv++;
+
75  }
+
76 
+
78  static void SHIFT_ARGC_ARGV(int& argc, const char* const*& argv) {
+
79  shiftArgcArgv(argc, argv);
+
80  }
+
81 
+
83  static bool isArgEqual(const char* arg, const char* token) {
+
84  return strcmp(arg, token) == 0;
+
85  }
+
86 
+
88  static bool isArgEqual(const char* arg, const __FlashStringHelper* token) {
+
89  return strcmp_P(arg, (const char*) token) == 0;
+
90  }
+
91 
+
93  CommandHandler(const char* name, const char* helpString):
+
94  mName(name),
+
95  mHelpString(helpString) {}
+
96 
+
98  CommandHandler(const __FlashStringHelper* name,
+
99  const __FlashStringHelper* helpString):
+
100  mName(name),
+
101  mHelpString(helpString) {}
102 
-
103 #endif
+
103  private:
+
104  ace_common::FCString const mName;
+
105  ace_common::FCString const mHelpString;
+
106 };
+
107 
+
108 } // cli
+
109 } // ace_utils
+
110 
+
111 #endif
-
ace_utils::cli::CommandHandler::isArgEqual
static bool isArgEqual(const char *arg, const __FlashStringHelper *token)
Test for equality when token is in PROGMEM.
Definition: CommandHandler.h:80
-
ace_utils::cli::CommandHandler::getName
ace_common::FCString getName() const
Return the name of the command.
Definition: CommandHandler.h:68
-
ace_utils::cli::CommandHandler
Signature for a command handler.
Definition: CommandHandler.h:47
-
ace_utils::cli::CommandHandler::CommandHandler
CommandHandler(const __FlashStringHelper *name, const __FlashStringHelper *helpString)
Constructor.
Definition: CommandHandler.h:90
-
ace_utils::cli::CommandHandler::getHelpString
ace_common::FCString getHelpString() const
Return the help string of the command.
Definition: CommandHandler.h:71
-
ace_utils::cli::CommandHandler::isArgEqual
static bool isArgEqual(const char *arg, const char *token)
Test for equality against token.
Definition: CommandHandler.h:75
-
ace_utils::cli::CommandHandler::CommandHandler
CommandHandler(const char *name, const char *helpString)
Constructor.
Definition: CommandHandler.h:85
+
ace_utils::cli::CommandHandler::isArgEqual
static bool isArgEqual(const char *arg, const __FlashStringHelper *token)
Test for equality when token is in PROGMEM.
Definition: CommandHandler.h:88
+
ace_utils::cli::CommandHandler::getName
ace_common::FCString getName() const
Return the name of the command.
Definition: CommandHandler.h:59
+
ace_utils::cli::CommandHandler::SHIFT_ARGC_ARGV
static void SHIFT_ARGC_ARGV(int &argc, const char *const *&argv)
Backwards compatibility with previous macro implementation .
Definition: CommandHandler.h:78
+
ace_utils::cli::CommandHandler
Signature for a command handler.
Definition: CommandHandler.h:38
+
ace_utils::cli::CommandHandler::CommandHandler
CommandHandler(const __FlashStringHelper *name, const __FlashStringHelper *helpString)
Constructor.
Definition: CommandHandler.h:98
+
ace_utils::cli::CommandHandler::getHelpString
ace_common::FCString getHelpString() const
Return the help string of the command.
Definition: CommandHandler.h:62
+
ace_utils::cli::CommandHandler::isArgEqual
static bool isArgEqual(const char *arg, const char *token)
Test for equality against token.
Definition: CommandHandler.h:83
+
ace_utils::cli::CommandHandler::CommandHandler
CommandHandler(const char *name, const char *helpString)
Constructor.
Definition: CommandHandler.h:93
ace_utils::cli::CommandHandler::run
virtual void run(Print &printer, int argc, const char *const *argv) const =0
Run the command.
+
ace_utils::cli::CommandHandler::shiftArgcArgv
static void shiftArgcArgv(int &argc, const char *const *&argv)
Increment argv and decrement argc so that it appears as if the command line arguments are shifted to ...
Definition: CommandHandler.h:72