On Tue, Jul 8, 2008 at 12:25 AM, Charles Hardin <[EMAIL PROTECTED]> wrote:
> Sorry to be one of those people, but the diffs were getting to me even with
> ignoring whitespace. So, just went by the README.
>
> - use TAB characters for indentation, not spaces
> - displayed TAB width is 4 characters
You have to post it as an attachment or the whitespace won't
necessarily survive :-)
>
> Thanks
> Index: src/openocd.c
> ===================================================================
> --- src/openocd.c (revision 769)
> +++ src/openocd.c (working copy)
> @@ -197,16 +197,16 @@
>
> namebuf = alloc_printf("%s(%d)", varname, idx );
>
> - nameObjPtr = Jim_NewStringObj(interp, namebuf, -1);
> - valObjPtr = Jim_NewIntObj(interp, val );
> - Jim_IncrRefCount(nameObjPtr);
> - Jim_IncrRefCount(valObjPtr);
> - result = Jim_SetVariable(interp, nameObjPtr, valObjPtr);
> - Jim_DecrRefCount(interp, nameObjPtr);
> - Jim_DecrRefCount(interp, valObjPtr);
> - free(namebuf);
> + nameObjPtr = Jim_NewStringObj(interp, namebuf, -1);
> + valObjPtr = Jim_NewIntObj(interp, val );
> + Jim_IncrRefCount(nameObjPtr);
> + Jim_IncrRefCount(valObjPtr);
> + result = Jim_SetVariable(interp, nameObjPtr, valObjPtr);
> + Jim_DecrRefCount(interp, nameObjPtr);
> + Jim_DecrRefCount(interp, valObjPtr);
> + free(namebuf);
> // printf( "%s = 0%08x\n", namebuf, val );
> - return result;
> + return result;
> }
>
> static int Jim_Command_mem2array(Jim_Interp *interp, int argc, Jim_Obj
> *const *argv)
> @@ -262,48 +262,48 @@
> break;
> default:
> Jim_SetResult(interp,
> - Jim_NewEmptyStringObj(interp));
> + Jim_NewEmptyStringObj(interp));
> Jim_AppendStrings( interp, Jim_GetResult(interp),
> - "Invalid width param, must
> be 8/16/32", NULL );
> + "Invalid width param, must be 8/16/32",
> NULL );
> return JIM_ERR;
> }
> if( len == 0 ){
> Jim_SetResult(interp,
> - Jim_NewEmptyStringObj(interp));
> + Jim_NewEmptyStringObj(interp));
> Jim_AppendStrings( interp, Jim_GetResult(interp),
> - "mem2array: zero width
> read?", NULL );
> + "mem2array: zero width read?", NULL );
> return JIM_ERR;
> }
> if( (addr + (len * width)) < addr ){
> Jim_SetResult(interp,
> - Jim_NewEmptyStringObj(interp));
> + Jim_NewEmptyStringObj(interp));
> Jim_AppendStrings( interp, Jim_GetResult(interp),
> - "mem2array: addr + len -
> wraps to zero?", NULL );
> + "mem2array: addr + len - wraps to zero?",
> NULL );
> return JIM_ERR;
> }
> /* absurd transfer size? */
> if( len > 65536 ){
> Jim_SetResult(interp,
> - Jim_NewEmptyStringObj(interp));
> + Jim_NewEmptyStringObj(interp));
> Jim_AppendStrings( interp, Jim_GetResult(interp),
> - "mem2array: absurd > 64K
> item request", NULL );
> + "mem2array: absurd > 64K item request",
> NULL );
> return JIM_ERR;
> }
>
> if( (width == 1) ||
> - ((width == 2) && ((addr & 1) == 0)) ||
> - ((width == 4) && ((addr & 3) == 0)) ){
> + ((width == 2) && ((addr & 1) == 0)) ||
> + ((width == 4) && ((addr & 3) == 0)) ){
> /* all is well */
> } else {
> char buf[100];
> Jim_SetResult(interp,
> - Jim_NewEmptyStringObj(interp));
> + Jim_NewEmptyStringObj(interp));
> sprintf( buf,
> - "mem2array address: 0x%08x is not aligned
> for %d byte reads",
> - addr, width );
> + "mem2array address: 0x%08x is not aligned for %d
> byte reads",
> + addr, width );
>
> Jim_AppendStrings( interp, Jim_GetResult(interp),
> - buf , NULL );
> + buf , NULL );
> return JIM_ERR;
> }
>
> @@ -324,20 +324,17 @@
> count = (sizeof(buffer)/width);
> }
>
> - retval = target->type->read_memory( target,
> -
> addr,
> -
> width,
> -
> count,
> -
> buffer );
> + retval = target->type->read_memory(target, addr, width,
> + count, buffer);
>
> if( retval != ERROR_OK ){
> /* BOO !*/
> LOG_ERROR("mem2array: Read @ 0x%08x, w=%d, cnt=%d,
> failed",
> - addr, width, count );
> + addr, width, count );
> Jim_SetResult(interp,
> -
> Jim_NewEmptyStringObj(interp));
> + Jim_NewEmptyStringObj(interp));
> Jim_AppendStrings( interp, Jim_GetResult(interp),
> - "mem2array: cannot read
> memory", NULL );
> + "mem2array: cannot read memory",
> NULL );
> e = JIM_ERR;
> len = 0;
> } else {
> @@ -360,7 +357,7 @@
> }
> }
> Jim_SetResult(interp,
> - Jim_NewEmptyStringObj(interp));
> + Jim_NewEmptyStringObj(interp));
>
> return JIM_OK;
> }
> @@ -385,50 +382,51 @@
>
> const char *result;
> int reslen;
> - result = Jim_GetString(Jim_GetResult(interp), &reslen);
> - if (retcode == JIM_ERR) {
> - int len, i;
> +
> + result = Jim_GetString(Jim_GetResult(interp), &reslen);
> + if (retcode == JIM_ERR) {
> + int len, i;
>
> - LOG_USER_N("Runtime error, file \"%s\", line %d:" JIM_NL,
> - interp->errorFileName, interp->errorLine);
> - LOG_USER_N(" %s" JIM_NL,
> - Jim_GetString(interp->result, NULL));
> - Jim_ListLength(interp, interp->stackTrace, &len);
> - for (i = 0; i < len; i+= 3) {
> - Jim_Obj *objPtr;
> - const char *proc, *file, *line;
> + LOG_USER_N("Runtime error, file \"%s\", line %d:" JIM_NL,
> + interp->errorFileName, interp->errorLine);
> + LOG_USER_N(" %s" JIM_NL,
> + Jim_GetString(interp->result, NULL));
> + Jim_ListLength(interp, interp->stackTrace, &len);
> + for (i = 0; i < len; i+= 3) {
> + Jim_Obj *objPtr;
> + const char *proc, *file, *line;
>
> - Jim_ListIndex(interp, interp->stackTrace, i, &objPtr,
> JIM_NONE);
> - proc = Jim_GetString(objPtr, NULL);
> - Jim_ListIndex(interp, interp->stackTrace, i+1, &objPtr,
> - JIM_NONE);
> - file = Jim_GetString(objPtr, NULL);
> - Jim_ListIndex(interp, interp->stackTrace, i+2, &objPtr,
> - JIM_NONE);
> - line = Jim_GetString(objPtr, NULL);
> - LOG_USER_N("In procedure '%s' called at file \"%s\", line %s"
> JIM_NL,
> - proc, file, line);
> - }
> - } else if (retcode == JIM_EXIT) {
> - // ignore.
> - //exit(Jim_GetExitCode(interp));
> - } else {
> - if (reslen) {
> - int i;
> - char buff[256+1];
> - for (i=0; i<reslen; i+=256)
> - {
> - int chunk;
> - chunk=reslen-i;
> - if (chunk>256)
> - chunk=256;
> - strncpy(buff, result, chunk);
> - buff[chunk]=0;
> - LOG_USER_N("%s", buff);
> - }
> - LOG_USER_N("%s", "\n");
> - }
> - }
> + Jim_ListIndex(interp, interp->stackTrace, i, &objPtr,
> JIM_NONE);
> + proc = Jim_GetString(objPtr, NULL);
> + Jim_ListIndex(interp, interp->stackTrace, i+1,
> &objPtr,
> + JIM_NONE);
> + file = Jim_GetString(objPtr, NULL);
> + Jim_ListIndex(interp, interp->stackTrace, i+2,
> &objPtr,
> + JIM_NONE);
> + line = Jim_GetString(objPtr, NULL);
> + LOG_USER_N("In procedure '%s' called at file \"%s\",
> line %s" JIM_NL,
> + proc, file, line);
> + }
> + } else if (retcode == JIM_EXIT) {
> + // ignore.
> + //exit(Jim_GetExitCode(interp));
> + } else {
> + if (reslen) {
> + int i;
> + char buff[256+1];
> + for (i=0; i<reslen; i+=256)
> + {
> + int chunk;
> + chunk=reslen-i;
> + if (chunk>256)
> + chunk=256;
> + strncpy(buff, result, chunk);
> + buff[chunk]=0;
> + LOG_USER_N("%s", buff);
> + }
> + LOG_USER_N("%s", "\n");
> + }
> + }
> return retval;
> }
>
> @@ -437,28 +435,28 @@
> static int Jim_Command_openocd_ignore(Jim_Interp *interp, int argc, Jim_Obj
> *const *argv, int ignore)
> {
> int retval;
> - char *cmd = (char*)Jim_GetString(argv[1], NULL);
> + char *cmd = (char*)Jim_GetString(argv[1], NULL);
>
> - Jim_Obj *tclOutput = Jim_NewStringObj(interp, "", 0);
> + Jim_Obj *tclOutput = Jim_NewStringObj(interp, "", 0);
>
> - if (startLoop)
> - {
> - // We don't know whether or not the telnet/gdb server is running...
> - target_call_timer_callbacks_now();
> - }
> + if (startLoop)
> + {
> + // We don't know whether or not the telnet/gdb server is
> running...
> + target_call_timer_callbacks_now();
> + }
>
> log_add_callback(tcl_output, tclOutput);
> - retval=command_run_line_internal(active_cmd_ctx, cmd);
> + retval=command_run_line_internal(active_cmd_ctx, cmd);
>
> - if (startLoop)
> - {
> - target_call_timer_callbacks_now();
> - }
> + if (startLoop)
> + {
> + target_call_timer_callbacks_now();
> + }
> log_remove_callback(tcl_output, tclOutput);
>
> Jim_SetResult(interp, tclOutput);
>
> - return (ignore||(retval==ERROR_OK))?JIM_OK:JIM_ERR;
> + return (ignore||(retval==ERROR_OK))?JIM_OK:JIM_ERR;
> }
>
> static int Jim_Command_openocd(Jim_Interp *interp, int argc, Jim_Obj *const
> *argv)
> @@ -480,8 +478,8 @@
> char *full_path=find_file(file);
> if (full_path==NULL)
> return JIM_ERR;
> - Jim_Obj *result = Jim_NewStringObj(interp, full_path, strlen(full_path));
> - free(full_path);
> + Jim_Obj *result = Jim_NewStringObj(interp, full_path,
> strlen(full_path));
> + free(full_path);
>
> Jim_SetResult(interp, result);
> return JIM_OK;
> @@ -580,11 +578,11 @@
>
> void initJim(void)
> {
> - Jim_CreateCommand(interp, "openocd", Jim_Command_openocd, NULL, NULL);
> - Jim_CreateCommand(interp, "openocd_throw", Jim_Command_openocd_throw,
> NULL, NULL);
> - Jim_CreateCommand(interp, "find", Jim_Command_find, NULL, NULL);
> - Jim_CreateCommand(interp, "echo", Jim_Command_echo, NULL, NULL);
> - Jim_CreateCommand(interp, "mem2array", Jim_Command_mem2array, NULL, NULL
> );
> + Jim_CreateCommand(interp, "openocd", Jim_Command_openocd, NULL, NULL);
> + Jim_CreateCommand(interp, "openocd_throw", Jim_Command_openocd_throw,
> NULL, NULL);
> + Jim_CreateCommand(interp, "find", Jim_Command_find, NULL, NULL);
> + Jim_CreateCommand(interp, "echo", Jim_Command_echo, NULL, NULL);
> + Jim_CreateCommand(interp, "mem2array", Jim_Command_mem2array, NULL,
> NULL );
>
> /* Set Jim's STDIO */
> interp->cookie_stdin = NULL;
> @@ -664,12 +662,12 @@
> {
> #ifdef JIM_EMBEDDED
> Jim_InitEmbedded();
> - /* Create an interpreter */
> - interp = Jim_CreateInterp();
> - /* Add all the Jim core commands */
> - Jim_RegisterCoreCommands(interp);
> + /* Create an interpreter */
> + interp = Jim_CreateInterp();
> + /* Add all the Jim core commands */
> + Jim_RegisterCoreCommands(interp);
> #endif
> -
> +
> initJim();
>
> /* initialize commandline interface */
> @@ -716,3 +714,4 @@
>
> return EXIT_SUCCESS;
> }
> +
> _______________________________________________
> Openocd-development mailing list
> [email protected]
> https://lists.berlios.de/mailman/listinfo/openocd-development
>
--
Øyvind Harboe
http://www.zylin.com/zy1000.html
ARM7 ARM9 XScale Cortex
JTAG debugger and flash programmer
_______________________________________________
Openocd-development mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/openocd-development