The CommandProcessor is the interface to install a run-time menu into an embedded system.
Dependents: A_CANAdapter USB2I2C
Diff: CommandProcessor.h
- Revision:
- 14:7971c8bd3f11
- Parent:
- 13:e1880be590c4
- Child:
- 15:5f30da93e3e2
--- a/CommandProcessor.h Wed Jun 15 12:50:56 2011 +0000 +++ b/CommandProcessor.h Sat Oct 01 20:01:44 2011 +0000 @@ -5,7 +5,7 @@ /// The CommandProcessor is the interface to install a run-time menu into an embedded system. /// This contains the complete interface to the CommandProcessor. /// -/// @version 1.03 +/// @version 1.04 /// /// @note The CommandProcessor is text-based, because it is intended to interact with a /// user. @@ -29,7 +29,7 @@ /// \li Tab completion of a command is available - so long as the user has /// typed at least the minimum number of unique characters. (e.g. 'He\<tab\>' /// will be replaced with 'Help') -/// \li Command cancellation is available - just enter the \<esc\> key and +/// \li Command cancellation is available - just enter the \<esc\> key and /// the buffer is erased. /// \li The user is not permitted to enter text longer than the defined buffer, /// to avoid buffer overrun and the possible memory damaging results. @@ -56,10 +56,10 @@ /// /// RUNRESULT_T SignOnBanner(char *p) /// { -/// puts("\r\nThis great program was built " __DATE__ " " __TIME__ "."); +/// puts("\r\nThis great program was built " __DATE__ " " __TIME__ "."); /// if (*p == '?') /// puts("\r\nMore details shown here.\r\n"); -/// return runok; +/// return runok; /// } /// RUNRESULT_T Who(char *p) /// { @@ -100,6 +100,9 @@ /// /// @note /// History +/// v1.04 1 October 2011 +/// \li Added configurable command line history for easy recall of previous commands +/// \li Clean up dead-code /// v1.03 29 May 2011 /// \li Slightly improved internal documentation. No external interfaces affected. /// v1.02 2 May 2011 @@ -215,14 +218,15 @@ /// /// This function has a number of parameters, which make the CommandProcessor quite flexible. /// - /// @param SignOnBanner function, which is used as a signon banner + /// @param SignOnBanner function, which is used as a signon banner /// @param config enables various default menu items, based on the bit values, combine the following: - /// \li CFG_ENABLE_TERMINATE - enables the Exit command - /// \li CFG_ENABLE_SYSTEM - enables system commands Echo, Help, etc. - /// \li CFG_ECHO_ON - initialize with echo on - /// \li CFG_CASE_INSENSITIVE - Command Parser is case insensitive - /// @param maxCmdLen sizes the buffer, and is the maximum number of characters in a single - /// command, including all command arguments + /// \li CFG_ENABLE_TERMINATE - enables the Exit command + /// \li CFG_ENABLE_SYSTEM - enables system commands Echo, Help, etc. + /// \li CFG_ECHO_ON - initialize with echo on + /// \li CFG_CASE_INSENSITIVE - Command Parser is case insensitive + /// @param maxCmdLen sizes the buffer, and is the maximum number of characters in a single + /// command, including all command arguments + /// @param historyLen sets the number of items that can be recalled from history /// @param kbhit is a user provided function to detect if a character is available for the CommandProcessor, /// and when using standard io, you can typically use kbhit, or _kbhit as your system provides. /// @param getch is a user provided function that provides a single character to the CommandProcessor @@ -230,11 +234,12 @@ /// @param puts is a user provided function that permits the CommandProcessor to output a string /// to which is automatically appended a \\n /// @returns INITRESULT_T to indicate if the init was successful or failed - /// + /// INITRESULT_T (*Init)( - CMD_T *SignOnBanner, + CMD_T *SignOnBanner, CONFIG_T config, int maxCmdLen, + int historyLen, int (*kbhit)(void), int (*getch)(void), int (*putch)(int ch), @@ -389,7 +394,4 @@ extern "C" CMDP_T * GetCommandProcessor(void); #endif - - -//int mystrnicmp(const char *l, const char *r, size_t n); #endif // COMMANDPROCESSOR_H