#include "jim-eventloop.h"
-int fast_and_dangerous = 0;
Jim_Interp *interp = NULL;
static int run_command(struct command_context *context,
log_add_callback(tcl_output, tclOutput);
- // turn words[0] into CMD_ARGV[-1] with this cast
retval = run_command(context, c, (const char **)words, nwords);
log_remove_callback(tcl_output, tclOutput);
return ERROR_OK;
}
-COMMAND_HANDLER(handle_fast_command)
-{
- if (CMD_ARGC != 1)
- return ERROR_COMMAND_SYNTAX_ERROR;
-
- fast_and_dangerous = strcmp("enable", CMD_ARGV[0]) == 0;
-
- return ERROR_OK;
-}
-
-
struct command_context* command_init(const char *startup_tcl)
{
struct command_context* context = malloc(sizeof(struct command_context));
handle_sleep_command, COMMAND_ANY,
"<n> [busy] - sleep for n milliseconds. "
"\"busy\" means busy wait");
- register_command(context, NULL, "fast",
- handle_fast_command, COMMAND_ANY,
- "fast <enable/disable> - place at beginning of "
- "config files. Sets defaults to fast and dangerous.");
return context;
}
command_helptext_add(cmd_list, help);
}
-/* return global variable long value or 0 upon failure */
-long jim_global_long(const char *variable)
-{
- Jim_Obj *objPtr = Jim_GetGlobalVariableStr(interp, variable, JIM_ERRMSG);
- long t;
- if (Jim_GetLong(interp, objPtr, &t) == JIM_OK)
- {
- return t;
- }
- return 0;
-}
-
#define DEFINE_PARSE_NUM_TYPE(name, type, func, min, max) \
int parse##name(const char *str, type *ul) \
{ \
#define ERROR_COMMAND_ARGUMENT_OVERFLOW (-604)
#define ERROR_COMMAND_ARGUMENT_UNDERFLOW (-605)
-extern int fast_and_dangerous;
-
extern Jim_Interp *interp;
void register_jim(struct command_context *context, const char *name,
Jim_CmdProc cmd, const char *help);
-long jim_global_long(const char *variable);
-
int parse_ulong(const char *str, unsigned long *ul);
int parse_ullong(const char *str, unsigned long long *ul);