Remove whitespace at end of lines, step 2.
- Replace '\s*$' with ''. git-svn-id: svn://svn.berlios.de/openocd/trunk@2380 b42882b7-edfa-0310-969c-e2dbd0fdcd60
This commit is contained in:
@@ -41,7 +41,7 @@ static inline void buf_set_u32(uint8_t* buffer, unsigned int first, unsigned int
|
||||
} else
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
|
||||
for (i = first; i < first + num; i++)
|
||||
{
|
||||
if (((value >> (i-first))&1) == 1)
|
||||
@@ -60,13 +60,13 @@ static inline uint32_t buf_get_u32(const uint8_t* buffer, unsigned int first, un
|
||||
{
|
||||
uint32_t result = 0;
|
||||
unsigned int i;
|
||||
|
||||
|
||||
for (i = first; i < first + num; i++)
|
||||
{
|
||||
if (((buffer[i/8]>>(i%8))&1) == 1)
|
||||
result |= 1 << (i-first);
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -896,7 +896,7 @@ DEFINE_PARSE_NUM_TYPE(_llong, long long, strtoll, LLONG_MIN, LLONG_MAX)
|
||||
return ERROR_COMMAND_ARGUMENT_UNDERFLOW; \
|
||||
*ul = n; \
|
||||
return ERROR_OK; \
|
||||
}
|
||||
}
|
||||
|
||||
#define DEFINE_PARSE_ULONG(name, type, min, max) \
|
||||
DEFINE_PARSE_WRAPPER(name, type, min, max, unsigned long, _ulong)
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
static inline int fileio_open_local(fileio_t *fileio)
|
||||
{
|
||||
char access[4];
|
||||
|
||||
|
||||
switch (fileio->access)
|
||||
{
|
||||
case FILEIO_READ:
|
||||
@@ -47,16 +47,16 @@ static inline int fileio_open_local(fileio_t *fileio)
|
||||
strcpy(access, "w+");
|
||||
break;
|
||||
case FILEIO_APPEND:
|
||||
strcpy(access, "a");
|
||||
strcpy(access, "a");
|
||||
break;
|
||||
case FILEIO_APPENDREAD:
|
||||
strcpy(access, "a+");
|
||||
strcpy(access, "a+");
|
||||
break;
|
||||
default:
|
||||
LOG_ERROR("BUG: access neither read, write nor readwrite");
|
||||
return ERROR_INVALID_ARGUMENTS;
|
||||
}
|
||||
|
||||
|
||||
/* win32 always opens in binary mode */
|
||||
#ifndef _WIN32
|
||||
if (fileio->type == FILEIO_BINARY)
|
||||
@@ -64,26 +64,26 @@ static inline int fileio_open_local(fileio_t *fileio)
|
||||
{
|
||||
strcat(access, "b");
|
||||
}
|
||||
|
||||
|
||||
if (!(fileio->file = open_file_from_path (fileio->url, access)))
|
||||
{
|
||||
LOG_ERROR("couldn't open %s", fileio->url);
|
||||
return ERROR_FILEIO_OPERATION_FAILED;
|
||||
}
|
||||
|
||||
|
||||
if ((fileio->access != FILEIO_WRITE) || (fileio->access == FILEIO_READWRITE))
|
||||
{
|
||||
/* NB! Here we use fseek() instead of stat(), since stat is a
|
||||
* more advanced operation that might not apply to e.g. a disk path
|
||||
* that refers to e.g. a tftp client */
|
||||
int result, result2;
|
||||
|
||||
|
||||
result = fseek(fileio->file, 0, SEEK_END);
|
||||
|
||||
fileio->size = ftell(fileio->file);
|
||||
|
||||
result2 = fseek(fileio->file, 0, SEEK_SET);
|
||||
|
||||
|
||||
result2 = fseek(fileio->file, 0, SEEK_SET);
|
||||
|
||||
if ((fileio->size < 0)||(result < 0)||(result2 < 0))
|
||||
{
|
||||
fileio_close(fileio);
|
||||
@@ -94,7 +94,7 @@ static inline int fileio_open_local(fileio_t *fileio)
|
||||
{
|
||||
fileio->size = 0x0;
|
||||
}
|
||||
|
||||
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ int fileio_open(fileio_t *fileio, const char *url, enum fileio_access access, en
|
||||
fileio->type = type;
|
||||
fileio->access = access;
|
||||
fileio->url = strdup(url);
|
||||
|
||||
|
||||
retval = fileio_open_local(fileio);
|
||||
|
||||
return retval;
|
||||
@@ -127,19 +127,19 @@ static inline int fileio_close_local(fileio_t *fileio)
|
||||
|
||||
return ERROR_FILEIO_OPERATION_FAILED;
|
||||
}
|
||||
|
||||
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
int fileio_close(fileio_t *fileio)
|
||||
{
|
||||
int retval;
|
||||
|
||||
|
||||
retval = fileio_close_local(fileio);
|
||||
|
||||
|
||||
free(fileio->url);
|
||||
fileio->url = NULL;
|
||||
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -151,14 +151,14 @@ int fileio_seek(fileio_t *fileio, uint32_t position)
|
||||
LOG_ERROR("couldn't seek file %s: %s", fileio->url, strerror(errno));
|
||||
return ERROR_FILEIO_OPERATION_FAILED;
|
||||
}
|
||||
|
||||
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
static inline int fileio_local_read(fileio_t *fileio, uint32_t size, uint8_t *buffer, uint32_t *size_read)
|
||||
{
|
||||
*size_read = fread(buffer, 1, size, fileio->file);
|
||||
|
||||
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
@@ -172,11 +172,11 @@ int fileio_read_u32(fileio_t *fileio, uint32_t *data)
|
||||
uint8_t buf[4];
|
||||
uint32_t size_read;
|
||||
int retval;
|
||||
|
||||
|
||||
if ((retval = fileio_local_read(fileio, 4, buf, &size_read)) != ERROR_OK)
|
||||
return retval;
|
||||
*data = be_to_h_u32(buf);
|
||||
|
||||
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
@@ -184,7 +184,7 @@ static inline int fileio_local_fgets(fileio_t *fileio, uint32_t size, char *buff
|
||||
{
|
||||
if (fgets(buffer, size, fileio->file) == NULL)
|
||||
return ERROR_FILEIO_OPERATION_FAILED;
|
||||
|
||||
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
@@ -196,19 +196,19 @@ int fileio_fgets(fileio_t *fileio, uint32_t size, char *buffer)
|
||||
static inline int fileio_local_write(fileio_t *fileio, uint32_t size, const uint8_t *buffer, uint32_t *size_written)
|
||||
{
|
||||
*size_written = fwrite(buffer, 1, size, fileio->file);
|
||||
|
||||
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
int fileio_write(fileio_t *fileio, uint32_t size, const uint8_t *buffer, uint32_t *size_written)
|
||||
{
|
||||
int retval;
|
||||
|
||||
|
||||
retval = fileio_local_write(fileio, size, buffer, size_written);
|
||||
|
||||
|
||||
if (retval == ERROR_OK)
|
||||
fileio->size += *size_written;
|
||||
|
||||
|
||||
return retval;;
|
||||
}
|
||||
|
||||
@@ -217,11 +217,11 @@ int fileio_write_u32(fileio_t *fileio, uint32_t data)
|
||||
uint8_t buf[4];
|
||||
uint32_t size_written;
|
||||
int retval;
|
||||
|
||||
|
||||
h_u32_to_be(buf, data);
|
||||
|
||||
|
||||
if ((retval = fileio_local_write(fileio, 4, buf, &size_written)) != ERROR_OK)
|
||||
return retval;
|
||||
|
||||
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
@@ -2,25 +2,25 @@
|
||||
*
|
||||
* Copyright 2005 Salvatore Sanfilippo <antirez@invece.org>
|
||||
* Copyright 2005 Clemens Hintze <c.hintze@gmx.net>
|
||||
* Copyright 2005 patthoyts - Pat Thoyts <patthoyts@users.sf.net>
|
||||
* Copyright 2005 patthoyts - Pat Thoyts <patthoyts@users.sf.net>
|
||||
* Copyright 2008 oharboe - Øyvind Harboe - oyvind.harboe@zylin.com
|
||||
* Copyright 2008 Andrew Lunn <andrew@lunn.ch>
|
||||
* Copyright 2008 Duane Ellis <openocd@duaneellis.com>
|
||||
* Copyright 2008 Uwe Klein <uklein@klein-messgeraete.de>
|
||||
*
|
||||
*
|
||||
* The FreeBSD license
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE JIM TCL PROJECT ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
@@ -33,7 +33,7 @@
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation
|
||||
* are those of the authors and should not be interpreted as representing
|
||||
* official policies, either expressed or implied, of the Jim Tcl Project.
|
||||
@@ -133,12 +133,12 @@ void Jim_DeleteFileHandler(Jim_Interp *interp, void *handle)
|
||||
}
|
||||
|
||||
// The same for signals.
|
||||
void Jim_CreateSignalHandler(Jim_Interp *interp, int signum,
|
||||
void Jim_CreateSignalHandler(Jim_Interp *interp, int signum,
|
||||
Jim_FileProc *proc, void *clientData,
|
||||
Jim_EventFinalizerProc *finalizerProc)
|
||||
{
|
||||
}
|
||||
void Jim_DeleteSignalHandler(Jim_Interp *interp, int signum)
|
||||
void Jim_DeleteSignalHandler(Jim_Interp *interp, int signum)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -192,7 +192,7 @@ jim_wide Jim_DeleteTimeHandler(Jim_Interp *interp, jim_wide id)
|
||||
JimGetTime(&cur_sec, &cur_ms);
|
||||
|
||||
te = eventLoop->timeEventHead;
|
||||
if (id >= eventLoop->timeEventNextId)
|
||||
if (id >= eventLoop->timeEventNextId)
|
||||
return -2; /* wrong event ID */
|
||||
while (te) {
|
||||
if (te->id == id) {
|
||||
@@ -271,7 +271,7 @@ int Jim_ProcessEvents(Jim_Interp *interp, int flags)
|
||||
while (fe != NULL) {
|
||||
int fd = fileno((FILE*)fe->handle);
|
||||
|
||||
if (fe->mask & JIM_EVENT_READABLE)
|
||||
if (fe->mask & JIM_EVENT_READABLE)
|
||||
FD_SET(fd, &rfds);
|
||||
if (fe->mask & JIM_EVENT_WRITABLE) FD_SET(fd, &wfds);
|
||||
if (fe->mask & JIM_EVENT_EXCEPTION) FD_SET(fd, &efds);
|
||||
@@ -419,7 +419,7 @@ void JimELAssocDataDeleProc(Jim_Interp *interp, void *data)
|
||||
Jim_Free(data);
|
||||
}
|
||||
|
||||
static int JimELVwaitCommand(Jim_Interp *interp, int argc,
|
||||
static int JimELVwaitCommand(Jim_Interp *interp, int argc,
|
||||
Jim_Obj *const *argv)
|
||||
{
|
||||
Jim_Obj *oldValue;
|
||||
@@ -461,7 +461,7 @@ void JimAfterTimeEventFinalizer(Jim_Interp *interp, void *clientData)
|
||||
Jim_DecrRefCount(interp, objPtr);
|
||||
}
|
||||
|
||||
static int JimELAfterCommand(Jim_Interp *interp, int argc,
|
||||
static int JimELAfterCommand(Jim_Interp *interp, int argc,
|
||||
Jim_Obj *const *argv)
|
||||
{
|
||||
jim_wide ms, id;
|
||||
@@ -510,7 +510,7 @@ static int JimELAfterCommand(Jim_Interp *interp, int argc,
|
||||
}
|
||||
default:
|
||||
fprintf(stderr,"unserviced option to after %d\n",option);
|
||||
}
|
||||
}
|
||||
return JIM_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,25 +2,25 @@
|
||||
*
|
||||
* Copyright 2005 Salvatore Sanfilippo <antirez@invece.org>
|
||||
* Copyright 2005 Clemens Hintze <c.hintze@gmx.net>
|
||||
* Copyright 2005 patthoyts - Pat Thoyts <patthoyts@users.sf.net>
|
||||
* Copyright 2005 patthoyts - Pat Thoyts <patthoyts@users.sf.net>
|
||||
* Copyright 2008 oharboe - Øyvind Harboe - oyvind.harboe@zylin.com
|
||||
* Copyright 2008 Andrew Lunn <andrew@lunn.ch>
|
||||
* Copyright 2008 Duane Ellis <openocd@duaneellis.com>
|
||||
* Copyright 2008 Uwe Klein <uklein@klein-messgeraete.de>
|
||||
*
|
||||
*
|
||||
* The FreeBSD license
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE JIM TCL PROJECT ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
@@ -33,7 +33,7 @@
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation
|
||||
* are those of the authors and should not be interpreted as representing
|
||||
* official policies, either expressed or implied, of the Jim Tcl Project.
|
||||
@@ -64,7 +64,7 @@ typedef void Jim_EventFinalizerProc(Jim_Interp *interp, void *clientData);
|
||||
#define JIM_EVENT_FEOF 8
|
||||
|
||||
#define JIM_API(x) x
|
||||
#define JIM_STATIC
|
||||
#define JIM_STATIC
|
||||
|
||||
JIM_STATIC int Jim_EventLoopOnLoad(Jim_Interp *interp);
|
||||
|
||||
|
||||
316
src/helper/jim.c
316
src/helper/jim.c
File diff suppressed because it is too large
Load Diff
@@ -2,25 +2,25 @@
|
||||
*
|
||||
* Copyright 2005 Salvatore Sanfilippo <antirez@invece.org>
|
||||
* Copyright 2005 Clemens Hintze <c.hintze@gmx.net>
|
||||
* Copyright 2005 patthoyts - Pat Thoyts <patthoyts@users.sf.net>
|
||||
* Copyright 2005 patthoyts - Pat Thoyts <patthoyts@users.sf.net>
|
||||
* Copyright 2008 oharboe - Øyvind Harboe - oyvind.harboe@zylin.com
|
||||
* Copyright 2008 Andrew Lunn <andrew@lunn.ch>
|
||||
* Copyright 2008 Duane Ellis <openocd@duaneellis.com>
|
||||
* Copyright 2008 Uwe Klein <uklein@klein-messgeraete.de>
|
||||
*
|
||||
*
|
||||
* The FreeBSD license
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE JIM TCL PROJECT ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
@@ -33,12 +33,12 @@
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation
|
||||
* are those of the authors and should not be interpreted as representing
|
||||
* official policies, either expressed or implied, of the Jim Tcl Project.
|
||||
*
|
||||
*--- Inline Header File Documentation ---
|
||||
*--- Inline Header File Documentation ---
|
||||
* [By Duane Ellis, openocd@duaneellis.com, 8/18/8]
|
||||
*
|
||||
* Belief is "Jim" would greatly benifit if Jim Internals where
|
||||
@@ -403,7 +403,7 @@ typedef void (Jim_FreeInternalRepProc)(struct Jim_Interp *interp,
|
||||
typedef void (Jim_DupInternalRepProc)(struct Jim_Interp *interp,
|
||||
struct Jim_Obj *srcPtr, Jim_Obj *dupPtr);
|
||||
typedef void (Jim_UpdateStringProc)(struct Jim_Obj *objPtr);
|
||||
|
||||
|
||||
typedef struct Jim_ObjType {
|
||||
const char *name; /* The name of the type. */
|
||||
Jim_FreeInternalRepProc *freeIntRepProc;
|
||||
@@ -449,7 +449,7 @@ typedef struct Jim_Var {
|
||||
Jim_Obj *objPtr;
|
||||
struct Jim_CallFrame *linkFramePtr;
|
||||
} Jim_Var;
|
||||
|
||||
|
||||
/* The cmd structure. */
|
||||
typedef int (*Jim_CmdProc)(struct Jim_Interp *interp, int argc,
|
||||
Jim_Obj *const *argv);
|
||||
@@ -591,7 +591,7 @@ typedef struct Jim_Reference {
|
||||
* };
|
||||
*
|
||||
* Jim_Nvp *result
|
||||
* e = Jim_Nvp_name2value(interp, yn, "y", &result);
|
||||
* e = Jim_Nvp_name2value(interp, yn, "y", &result);
|
||||
* returns &yn[0];
|
||||
* e = Jim_Nvp_name2value(interp, yn, "n", &result);
|
||||
* returns &yn[1];
|
||||
@@ -605,7 +605,7 @@ typedef struct {
|
||||
const char *name;
|
||||
int value;
|
||||
} Jim_Nvp;
|
||||
|
||||
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Exported API prototypes.
|
||||
@@ -628,7 +628,7 @@ typedef struct {
|
||||
#define Jim_FreeHashTableIterator(iter) Jim_Free(iter)
|
||||
|
||||
#ifdef DOXYGEN
|
||||
#define JIM_STATIC
|
||||
#define JIM_STATIC
|
||||
#define JIM_API(X) X
|
||||
#else
|
||||
#ifndef __JIM_CORE__
|
||||
@@ -758,15 +758,15 @@ JIM_STATIC void * JIM_API(Jim_SetStderr) (Jim_Interp *interp, void *fp);
|
||||
|
||||
/* commands */
|
||||
JIM_STATIC void JIM_API(Jim_RegisterCoreCommands) (Jim_Interp *interp);
|
||||
JIM_STATIC int JIM_API(Jim_CreateCommand) (Jim_Interp *interp,
|
||||
JIM_STATIC int JIM_API(Jim_CreateCommand) (Jim_Interp *interp,
|
||||
const char *cmdName, Jim_CmdProc cmdProc, void *privData,
|
||||
Jim_DelCmdProc delProc);
|
||||
JIM_STATIC int JIM_API(Jim_CreateProcedure) (Jim_Interp *interp,
|
||||
JIM_STATIC int JIM_API(Jim_CreateProcedure) (Jim_Interp *interp,
|
||||
const char *cmdName, Jim_Obj *argListObjPtr, Jim_Obj *staticsListObjPtr,
|
||||
Jim_Obj *bodyObjPtr, int arityMin, int arityMax);
|
||||
JIM_STATIC int JIM_API(Jim_DeleteCommand) (Jim_Interp *interp,
|
||||
const char *cmdName);
|
||||
JIM_STATIC int JIM_API(Jim_RenameCommand) (Jim_Interp *interp,
|
||||
JIM_STATIC int JIM_API(Jim_RenameCommand) (Jim_Interp *interp,
|
||||
const char *oldName, const char *newName);
|
||||
JIM_STATIC Jim_Cmd * JIM_API(Jim_GetCommand) (Jim_Interp *interp,
|
||||
Jim_Obj *objPtr, int flags);
|
||||
@@ -865,7 +865,7 @@ JIM_STATIC void JIM_API(Jim_SetDouble)(Jim_Interp *interp, Jim_Obj *objPtr,
|
||||
JIM_STATIC Jim_Obj * JIM_API(Jim_NewDoubleObj)(Jim_Interp *interp, double doubleValue);
|
||||
|
||||
/* shared strings */
|
||||
JIM_STATIC const char * JIM_API(Jim_GetSharedString) (Jim_Interp *interp,
|
||||
JIM_STATIC const char * JIM_API(Jim_GetSharedString) (Jim_Interp *interp,
|
||||
const char *str);
|
||||
JIM_STATIC void JIM_API(Jim_ReleaseSharedString) (Jim_Interp *interp,
|
||||
const char *str);
|
||||
@@ -875,9 +875,9 @@ JIM_STATIC void JIM_API(Jim_WrongNumArgs) (Jim_Interp *interp, int argc,
|
||||
Jim_Obj *const *argv, const char *msg);
|
||||
JIM_STATIC int JIM_API(Jim_GetEnum) (Jim_Interp *interp, Jim_Obj *objPtr,
|
||||
const char * const *tablePtr, int *indexPtr, const char *name, int flags);
|
||||
JIM_STATIC int JIM_API(Jim_GetNvp) (Jim_Interp *interp,
|
||||
JIM_STATIC int JIM_API(Jim_GetNvp) (Jim_Interp *interp,
|
||||
Jim_Obj *objPtr,
|
||||
const Jim_Nvp *nvp_table,
|
||||
const Jim_Nvp *nvp_table,
|
||||
const Jim_Nvp **result);
|
||||
JIM_STATIC int JIM_API(Jim_ScriptIsComplete) (const char *s, int len,
|
||||
char *stateCharPtr);
|
||||
@@ -892,7 +892,7 @@ JIM_STATIC int JIM_API(Jim_DeleteAssocData)(Jim_Interp *interp, const char *key)
|
||||
/* API import/export functions */
|
||||
JIM_STATIC int JIM_API(Jim_GetApi) (Jim_Interp *interp, const char *funcname,
|
||||
void *targetPtrPtr);
|
||||
JIM_STATIC int JIM_API(Jim_RegisterApi) (Jim_Interp *interp,
|
||||
JIM_STATIC int JIM_API(Jim_RegisterApi) (Jim_Interp *interp,
|
||||
const char *funcname, void *funcptr);
|
||||
|
||||
/* Packages C API */
|
||||
@@ -932,20 +932,20 @@ JIM_STATIC int JIM_API(Jim_Nvp_name2value_obj_nocase)(Jim_Interp *interp, const
|
||||
JIM_STATIC int JIM_API(Jim_Nvp_value2name_obj)(Jim_Interp *interp, const Jim_Nvp *nvp_table, Jim_Obj *value_obj, Jim_Nvp **result);
|
||||
|
||||
/** prints a nice 'unknown' parameter error message to the 'result' */
|
||||
JIM_STATIC void JIM_API(Jim_SetResult_NvpUnknown)(Jim_Interp *interp,
|
||||
JIM_STATIC void JIM_API(Jim_SetResult_NvpUnknown)(Jim_Interp *interp,
|
||||
Jim_Obj *param_name,
|
||||
Jim_Obj *param_value,
|
||||
const Jim_Nvp *nvp_table);
|
||||
|
||||
|
||||
/** Debug: convert argc/argv into a printable string for printf() debug
|
||||
*
|
||||
*
|
||||
* \param interp - the interpeter
|
||||
* \param argc - arg count
|
||||
* \param argv - the objects
|
||||
*
|
||||
* \returns string pointer holding the text.
|
||||
*
|
||||
*
|
||||
* Note, next call to this function will free the old (last) string.
|
||||
*
|
||||
* For example might want do this:
|
||||
@@ -958,11 +958,11 @@ JIM_STATIC void JIM_API(Jim_SetResult_NvpUnknown)(Jim_Interp *interp,
|
||||
JIM_STATIC const char *JIM_API(Jim_Debug_ArgvString)(Jim_Interp *interp, int argc, Jim_Obj *const *argv);
|
||||
|
||||
|
||||
/** A TCL -ish GetOpt like code.
|
||||
/** A TCL -ish GetOpt like code.
|
||||
*
|
||||
* Some TCL objects have various "configuration" values.
|
||||
* For example - in Tcl/Tk the "buttons" have many options.
|
||||
*
|
||||
*
|
||||
* Usefull when dealing with command options.
|
||||
* that may come in any order...
|
||||
*
|
||||
@@ -972,7 +972,7 @@ JIM_STATIC const char *JIM_API(Jim_Debug_ArgvString)(Jim_Interp *interp, int arg
|
||||
|
||||
typedef struct jim_getopt {
|
||||
Jim_Interp *interp;
|
||||
int argc;
|
||||
int argc;
|
||||
Jim_Obj * const * argv;
|
||||
int isconfigure; /* non-zero if configure */
|
||||
} Jim_GetOptInfo;
|
||||
@@ -981,7 +981,7 @@ typedef struct jim_getopt {
|
||||
*
|
||||
* Example (short and incomplete):
|
||||
* \code
|
||||
* Jim_GetOptInfo goi;
|
||||
* Jim_GetOptInfo goi;
|
||||
*
|
||||
* Jim_GetOpt_Setup(&goi, interp, argc, argv);
|
||||
*
|
||||
@@ -1016,10 +1016,10 @@ typedef struct jim_getopt {
|
||||
* }
|
||||
*
|
||||
* \endcode
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/** Setup GETOPT
|
||||
/** Setup GETOPT
|
||||
*
|
||||
* \param goi - get opt info to be initialized
|
||||
* \param interp - jim interp
|
||||
@@ -1028,14 +1028,14 @@ typedef struct jim_getopt {
|
||||
*
|
||||
* \code
|
||||
* Jim_GetOptInfo goi;
|
||||
*
|
||||
*
|
||||
* Jim_GetOptSetup(&goi, interp, argc, argv);
|
||||
* \endcode
|
||||
*/
|
||||
|
||||
JIM_STATIC int JIM_API(Jim_GetOpt_Setup)(Jim_GetOptInfo *goi,
|
||||
Jim_Interp *interp,
|
||||
int argc,
|
||||
JIM_STATIC int JIM_API(Jim_GetOpt_Setup)(Jim_GetOptInfo *goi,
|
||||
Jim_Interp *interp,
|
||||
int argc,
|
||||
Jim_Obj * const * argv);
|
||||
|
||||
|
||||
@@ -1050,7 +1050,7 @@ JIM_STATIC void JIM_API(Jim_GetOpt_Debug)(Jim_GetOptInfo *goi);
|
||||
*
|
||||
* \param goi - get opt info
|
||||
* \param puthere - where param is put
|
||||
*
|
||||
*
|
||||
*/
|
||||
JIM_STATIC int JIM_API(Jim_GetOpt_Obj)(Jim_GetOptInfo *goi, Jim_Obj **puthere);
|
||||
|
||||
@@ -1103,7 +1103,7 @@ JIM_STATIC int JIM_API(Jim_GetOpt_Nvp)(Jim_GetOptInfo *goi, const Jim_Nvp *looku
|
||||
* \code
|
||||
*
|
||||
* while (goi.argc) {
|
||||
* // Get the next option
|
||||
* // Get the next option
|
||||
* e = Jim_GetOpt_Nvp(&goi, cmd_options, &n);
|
||||
* if (e != JIM_OK) {
|
||||
* // option was not recognized
|
||||
@@ -1281,7 +1281,7 @@ static void Jim_InitExtension(Jim_Interp *interp)
|
||||
JIM_GET_API(Nvp_name2value);
|
||||
JIM_GET_API(Nvp_name2value_nocase);
|
||||
JIM_GET_API(Nvp_name2value_simple);
|
||||
|
||||
|
||||
JIM_GET_API(Nvp_value2name);
|
||||
JIM_GET_API(Nvp_value2name_simple);
|
||||
|
||||
|
||||
@@ -28,12 +28,12 @@
|
||||
|
||||
#include "command.h"
|
||||
|
||||
/* logging priorities
|
||||
* LOG_LVL_SILENT - turn off all output. In lieu of try + catch this can be used as a
|
||||
/* logging priorities
|
||||
* LOG_LVL_SILENT - turn off all output. In lieu of try + catch this can be used as a
|
||||
* feeble ersatz.
|
||||
* LOG_LVL_USER - user messages. Could be anything from information
|
||||
* LOG_LVL_USER - user messages. Could be anything from information
|
||||
* to progress messags. These messages do not represent
|
||||
* incorrect or unexpected behaviour, just normal execution.
|
||||
* incorrect or unexpected behaviour, just normal execution.
|
||||
* LOG_LVL_ERROR - fatal errors, that are likely to cause program abort
|
||||
* LOG_LVL_WARNING - non-fatal errors, that may be resolved later
|
||||
* LOG_LVL_INFO - state information, etc.
|
||||
@@ -50,11 +50,11 @@ enum log_levels
|
||||
LOG_LVL_DEBUG = 3
|
||||
};
|
||||
|
||||
extern void log_printf(enum log_levels level, const char *file, int line,
|
||||
const char *function, const char *format, ...)
|
||||
extern void log_printf(enum log_levels level, const char *file, int line,
|
||||
const char *function, const char *format, ...)
|
||||
__attribute__ ((format (printf, 5, 6)));
|
||||
extern void log_printf_lf(enum log_levels level, const char *file, int line,
|
||||
const char *function, const char *format, ...)
|
||||
const char *function, const char *format, ...)
|
||||
__attribute__ ((format (printf, 5, 6)));
|
||||
extern int log_register_commands(struct command_context_s *cmd_ctx);
|
||||
extern int log_init(struct command_context_s *cmd_ctx);
|
||||
@@ -118,7 +118,7 @@ extern int debug_level;
|
||||
#define ERROR_INVALID_ARGUMENTS ERROR_COMMAND_SYNTAX_ERROR
|
||||
#define ERROR_NO_CONFIG_FILE (-2)
|
||||
#define ERROR_BUF_TOO_SMALL (-3)
|
||||
/* see "Error:" log entry for meaningful message to the user. The caller should
|
||||
/* see "Error:" log entry for meaningful message to the user. The caller should
|
||||
* make no assumptions about what went wrong and try to handle the problem.
|
||||
*/
|
||||
#define ERROR_FAIL (-4)
|
||||
|
||||
@@ -58,7 +58,7 @@ int add_default_dirs(void)
|
||||
#ifdef _WIN32
|
||||
/* Add the parent of the directory where openocd.exe resides to the
|
||||
* config script search path.
|
||||
* Directory layout:
|
||||
* Directory layout:
|
||||
* bin\openocd.exe
|
||||
* lib\openocd
|
||||
* event\at91eb40a_reset.cfg
|
||||
@@ -68,7 +68,7 @@ int add_default_dirs(void)
|
||||
char strExePath [MAX_PATH];
|
||||
GetModuleFileName (NULL, strExePath, MAX_PATH);
|
||||
/* Either this code will *always* work or it will SEGFAULT giving
|
||||
* excellent information on the culprit.
|
||||
* excellent information on the culprit.
|
||||
*/
|
||||
*strrchr(strExePath, '\\') = 0;
|
||||
strcat(strExePath, "\\..");
|
||||
@@ -115,16 +115,16 @@ int parse_cmdline_args(struct command_context_s *cmd_ctx, int argc, char *argv[]
|
||||
char command_buffer[128];
|
||||
|
||||
while (1)
|
||||
{
|
||||
{
|
||||
/* getopt_long stores the option index here. */
|
||||
int option_index = 0;
|
||||
|
||||
|
||||
c = getopt_long(argc, argv, "hvd::l:f:s:c:p", long_options, &option_index);
|
||||
|
||||
|
||||
/* Detect the end of the options. */
|
||||
if (c == -1)
|
||||
break;
|
||||
|
||||
|
||||
switch (c)
|
||||
{
|
||||
case 0:
|
||||
@@ -156,13 +156,13 @@ int parse_cmdline_args(struct command_context_s *cmd_ctx, int argc, char *argv[]
|
||||
{
|
||||
snprintf(command_buffer, 128, "log_output %s", optarg);
|
||||
command_run_line(cmd_ctx, command_buffer);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'c': /* --command | -c */
|
||||
if (optarg)
|
||||
{
|
||||
add_config_command(optarg);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'p': /* --pipe | -p */
|
||||
#if BUILD_ECOSBOARD == 1
|
||||
@@ -187,7 +187,7 @@ int parse_cmdline_args(struct command_context_s *cmd_ctx, int argc, char *argv[]
|
||||
LOG_OUTPUT("--command | -c\trun <command>\n");
|
||||
LOG_OUTPUT("--pipe | -p\tuse pipes for gdb communication\n");
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
if (version_flag)
|
||||
{
|
||||
@@ -195,6 +195,6 @@ int parse_cmdline_args(struct command_context_s *cmd_ctx, int argc, char *argv[]
|
||||
// It is not an error to request the VERSION number.
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
/*
|
||||
/*
|
||||
* clear_malloc
|
||||
*
|
||||
* will alloc memory and clear it
|
||||
@@ -203,11 +203,11 @@ int win_select(int max_fd, fd_set *rfds, fd_set *wfds, fd_set *efds, struct time
|
||||
FD_ZERO(&aread);
|
||||
FD_ZERO(&awrite);
|
||||
FD_ZERO(&aexcept);
|
||||
|
||||
|
||||
limit = GetTickCount() + ms_total;
|
||||
do {
|
||||
retcode = 0;
|
||||
|
||||
|
||||
if (sock_max_fd >= 0) {
|
||||
/* overwrite the zero'd sets here; the select call
|
||||
* will clear those that are not active */
|
||||
@@ -245,7 +245,7 @@ int win_select(int max_fd, fd_set *rfds, fd_set *wfds, fd_set *efds, struct time
|
||||
if (SAFE_FD_ISSET(handle_slot_to_fd[i], rfds)) {
|
||||
DWORD dwBytes;
|
||||
long handle = _get_osfhandle(handle_slot_to_fd[i]);
|
||||
|
||||
|
||||
if (PeekNamedPipe((HANDLE)handle, NULL, 0, NULL, &dwBytes, NULL))
|
||||
{
|
||||
/* check to see if gdb pipe has data available */
|
||||
|
||||
@@ -57,15 +57,15 @@ int timeval_subtract(struct timeval *result, struct timeval *x, struct timeval *
|
||||
int timeval_add(struct timeval *result, struct timeval *x, struct timeval *y)
|
||||
{
|
||||
result->tv_sec = x->tv_sec + y->tv_sec;
|
||||
|
||||
|
||||
result->tv_usec = x->tv_usec + y->tv_usec;
|
||||
|
||||
|
||||
while (result->tv_usec > 1000000)
|
||||
{
|
||||
result->tv_usec -= 1000000;
|
||||
result->tv_sec++;
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -73,13 +73,13 @@ int timeval_add_time(struct timeval *result, int sec, int usec)
|
||||
{
|
||||
result->tv_sec += sec;
|
||||
result->tv_usec += usec;
|
||||
|
||||
|
||||
while (result->tv_usec > 1000000)
|
||||
{
|
||||
result->tv_usec -= 1000000;
|
||||
result->tv_sec++;
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -91,11 +91,11 @@ void duration_start_measure(duration_t *duration)
|
||||
int duration_stop_measure(duration_t *duration, char **text)
|
||||
{
|
||||
struct timeval end;
|
||||
|
||||
|
||||
gettimeofday(&end, NULL);
|
||||
|
||||
|
||||
timeval_subtract(&duration->duration, &end, &duration->start);
|
||||
|
||||
|
||||
if (text)
|
||||
{
|
||||
float t;
|
||||
@@ -104,18 +104,18 @@ int duration_stop_measure(duration_t *duration, char **text)
|
||||
*text = malloc(100);
|
||||
snprintf(*text, 100, "%fs", t);
|
||||
}
|
||||
|
||||
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
long long timeval_ms()
|
||||
{
|
||||
struct timeval now;
|
||||
struct timeval now;
|
||||
long long t = 0;
|
||||
gettimeofday(&now, NULL);
|
||||
|
||||
|
||||
t += now.tv_usec/1000;
|
||||
t += now.tv_sec*1000;
|
||||
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user