#include "config.h"
#endif
-#include "replacements.h"
+// @todo the inclusion of target.h here is a layering violation
#include "target.h"
#include "command.h"
#include "configuration.h"
-
#include "log.h"
#include "time_support.h"
#include "jim-eventloop.h"
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <errno.h>
int fast_and_dangerous = 0;
Jim_Interp *interp = NULL;
/* find command */
c = context->commands;
-
+
while(NULL != c)
- {
+ {
if (strcmp(name, c->name) == 0)
{
/* unlink command */
/* first element in command list */
context->commands = c->next;
}
-
+
/* unregister children */
while(NULL != c->children)
{
free(c2);
c2 = NULL;
}
-
+
/* delete command */
free(c->name);
c->name = NULL;
c = NULL;
return ERROR_OK;
}
-
+
/* remember the last command for unlinking */
p = c;
c = c->next;
int reslen;
result = Jim_GetString(Jim_GetResult(interp), &reslen);
- if (reslen) {
+ if (reslen>0)
+ {
int i;
char buff[256+1];
for (i = 0; i < reslen; i += 256)
}
LOG_USER_N("%s", "\n");
}
+ retval=ERROR_OK;
}
return retval;
}
{
command_context_t* context = malloc(sizeof(command_context_t));
extern const char startup_tcl[];
+ const char *HostOs;
context->mode = COMMAND_EXEC;
context->commands = NULL;
Jim_RegisterCoreCommands(interp);
#endif
+#if defined( _MSC_VER )
+ /* WinXX - is generic, the forward
+ * looking problem is this:
+ *
+ * "win32" or "win64"
+ *
+ * "winxx" is generic.
+ */
+ HostOs = "winxx";
+#elif defined( __LINUX__)
+ HostOs = "linux";
+#elif defined( __DARWIN__ )
+ HostOs = "darwin";
+#elif defined( __CYGWIN__ )
+ HostOs = "cygwin";
+#elif defined( __MINGW32__ )
+ HostOs = "mingw32";
+#else
+ HostOs = "other";
+#endif
+ Jim_SetGlobalVariableStr( interp, "ocd_HOSTOS", Jim_NewStringObj( interp, HostOs , strlen(HostOs)) );
+
Jim_CreateCommand(interp, "ocd_find", jim_find, NULL, NULL);
Jim_CreateCommand(interp, "echo", jim_echo, NULL, NULL);
Jim_CreateCommand(interp, "capture", jim_capture, NULL, NULL);
} else
{
long long then=timeval_ms();
- while ((timeval_ms()-then)<duration)
+ while ((timeval_ms()-then)<(long long)duration)
{
target_call_timer_callbacks_now();
usleep(1000);