* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
***************************************************************************/
#ifndef COMMAND_H
#define COMMAND_H
-#include <helper/types.h>
-
-/* Integrate the JIM TCL interpretor into the command processing. */
-#if BUILD_ECOSBOARD
-#include <stdio.h>
-#include <stdarg.h>
-#endif
-
-#include <jim.h>
#include <jim-nvp.h>
/* To achieve C99 printf compatibility in MinGW, gnu_printf should be
struct command_context;
-/* / The type signature for command context's output handler. */
+/** The type signature for command context's output handler. */
typedef int (*command_output_handler_t)(struct command_context *context,
const char *line);
typedef __COMMAND_HANDLER((*command_handler_t));
struct command {
- const char *name;
- const char *help;
- const char *usage;
+ char *name;
+ char *help;
+ char *usage;
struct command *parent;
struct command *children;
command_handler_t handler;
- Jim_CmdProc jim_handler;
+ Jim_CmdProc *jim_handler;
void *jim_handler_data;
enum command_mode mode;
struct command *next;
struct command_registration {
const char *name;
command_handler_t handler;
- Jim_CmdProc jim_handler;
+ Jim_CmdProc *jim_handler;
void *jim_handler_data;
enum command_mode mode;
const char *help;
- /* / a string listing the options and arguments, required or optional */
+ /** a string listing the options and arguments, required or optional */
const char *usage;
/**
const struct command_registration *chain;
};
-/* / Use this as the last entry in an array of command_registration records. */
+/** Use this as the last entry in an array of command_registration records. */
#define COMMAND_REGISTRATION_DONE { .name = NULL, .chain = NULL }
/**
int parse ## name(const char *str, type * ul)
DECLARE_PARSE_WRAPPER(_uint, unsigned);
+DECLARE_PARSE_WRAPPER(_u64, uint64_t);
DECLARE_PARSE_WRAPPER(_u32, uint32_t);
DECLARE_PARSE_WRAPPER(_u16, uint16_t);
DECLARE_PARSE_WRAPPER(_u8, uint8_t);
int command_parse_bool_arg(const char *in, bool *out);
COMMAND_HELPER(handle_command_parse_bool, bool *out, const char *label);
-/* / parses an on/off command argument */
+/** parses an on/off command argument */
#define COMMAND_PARSE_ON_OFF(in, out) \
COMMAND_PARSE_BOOL(in, out, "on", "off")
-/* / parses an enable/disable command argument */
+/** parses an enable/disable command argument */
#define COMMAND_PARSE_ENABLE(in, out) \
COMMAND_PARSE_BOOL(in, out, "enable", "disable")