} else
{
unsigned int i;
-
+
for (i = first; i < first + num; i++)
{
if (((value >> (i-first))&1) == 1)
{
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;
}
}
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)
static inline int fileio_open_local(fileio_t *fileio)
{
char access[4];
-
+
switch (fileio->access)
{
case FILEIO_READ:
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)
{
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);
{
fileio->size = 0x0;
}
-
+
return ERROR_OK;
}
fileio->type = type;
fileio->access = access;
fileio->url = strdup(url);
-
+
retval = fileio_open_local(fileio);
return retval;
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;
}
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;
}
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;
}
{
if (fgets(buffer, size, fileio->file) == NULL)
return ERROR_FILEIO_OPERATION_FAILED;
-
+
return ERROR_OK;
}
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;;
}
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;
}
*
* 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
* 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.
}
// 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)
{
}
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) {
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);
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;
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;
}
default:
fprintf(stderr,"unserviced option to after %d\n",option);
- }
+ }
return JIM_OK;
}
*
* 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
* 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.
#define JIM_EVENT_FEOF 8
#define JIM_API(x) x
-#define JIM_STATIC
+#define JIM_STATIC
JIM_STATIC int Jim_EventLoopOnLoad(Jim_Interp *interp);
*
* 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>
* Copyright 2008 Steve Bennett <steveb@workware.net.au>
- *
+ *
* 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
* 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.
free(buf);
#endif
}
-
+
/*
* Convert a string to a jim_wide INTEGER.
}
/* Search 's1' inside 's2', starting to search from char 'index' of 's2'.
- * The index of the first occurrence of s1 in s2 is returned.
+ * The index of the first occurrence of s1 in s2 is returned.
* If s1 is not found inside s2, -1 is returned. */
int JimStringFirst(const char *s1, int l1, const char *s2, int l2, int index)
{
va_list ap;
va_start(ap, fmt);
- /*
+ /*
* Send it here first.. Assuming STDIO still works
*/
fprintf(stderr, JIM_NL "JIM INTERPRETER PANIC: ");
fprintf(fp,"[backtrace] of 'nm <executable>' in the bug report." JIM_NL);
}
#endif
-
+
/* This may actually crash... we do it last */
if (interp && interp->cookie_stderr) {
Jim_fprintf(interp, interp->cookie_stderr, JIM_NL "JIM INTERPRETER PANIC: ");
char *Jim_StrDupLen(const char *s, int l)
{
char *copy = Jim_Alloc(l + 1);
-
+
memcpy(copy, s, l + 1);
copy[l] = 0; /* Just to be sure, original could be substring */
return copy;
Jim_HashEntry *he, *nextHe;
if (ht->table[i] == NULL) continue;
-
+
/* For each hash entry on this slot... */
he = ht->table[i];
while (he) {
/* Initialize a parser context.
* 'prg' is a pointer to the program text, linenr is the line
* number of the first line contained in the program. */
-void JimParserInit(struct JimParserCtx *pc, const char *prg,
+void JimParserInit(struct JimParserCtx *pc, const char *prg,
int len, int linenr)
{
pc->prg = prg;
{
char *p = dest;
int i, len;
-
+
if (slen == -1)
slen = strlen(s);
* For exmple the string:
*
* {expand}$a
- *
+ *
* will return as first token "expand", of type JIM_TT_STR
*
* While the string:
/* This is the core of the [format] command.
* TODO: Lots of things work - via a hack
- * However, no format item can be >= JIM_MAX_FMT
+ * However, no format item can be >= JIM_MAX_FMT
*/
#define JIM_MAX_FMT 2048
static Jim_Obj *Jim_FormatString_Inner(Jim_Interp *interp, Jim_Obj *fmtObjPtr,
const char *fmt, *_fmt;
int fmtLen;
Jim_Obj *resObjPtr;
-
+
fmt = Jim_GetString(fmtObjPtr, &fmtLen);
_fmt = fmt;
case 'u': /* unsigned */
case 'f': /* float */
break;
-
+
/* non-terminals */
case '0': /* zero pad */
zpad = 1;
altfm = 1;
fmt++; fmtLen--;
goto next_fmt;
-
+
case '.':
inprec = 1;
fmt++; fmtLen--;
goto next_fmt;
break;
}
-
-
+
+
if (*fmt != '%') {
if (objc == 0) {
not_enough_args:
objc--;
}
}
-
+
/*
* Create the formatter
* cause we cheat and use sprintf()
case 'X':
/* jim widevaluse are 64bit */
if (sizeof(jim_wide) == sizeof(long long)) {
- *cp++ = 'l';
+ *cp++ = 'l';
*cp++ = 'l';
} else {
*cp++ = 'l';
printf("FMT was: %s\n", fmt_str);
printf("RES was: |%s|\n", sprintf_buf);
#endif
-
+
sprintf_buf[ JIM_MAX_FMT - 1] = 0;
Jim_AppendString(interp, resObjPtr, sprintf_buf, strlen(sprintf_buf));
/* next obj */
char *sprintf_buf = malloc(JIM_MAX_FMT);
Jim_Obj *t = Jim_FormatString_Inner(interp, fmtObjPtr, objc, objv, sprintf_buf);
free(sprintf_buf);
- return t;
+ return t;
}
/* -----------------------------------------------------------------------------
return JIM_ERR;
}
-int Jim_GetNvp(Jim_Interp *interp,
+int Jim_GetNvp(Jim_Interp *interp,
Jim_Obj *objPtr,
- const Jim_Nvp *nvp_table,
+ const Jim_Nvp *nvp_table,
const Jim_Nvp ** result)
{
Jim_Nvp *n;
* The command structure is a pre-computed representation of the
* command length and arguments structure as a simple liner array
* of integers.
- *
+ *
* For example the script:
*
* puts hello
cmdPtr->arityMin = arityMin;
cmdPtr->arityMax = arityMax;
cmdPtr->staticVars = NULL;
-
+
/* Create the statics hash table. */
if (staticsListObjPtr) {
int len, i;
return JIM_OK;
}
-int Jim_RenameCommand(Jim_Interp *interp, const char *oldName,
+int Jim_RenameCommand(Jim_Interp *interp, const char *oldName,
const char *newName)
{
Jim_Cmd *cmdPtr;
const char *name;
Jim_Var *varPtr;
int err;
-
+
if ((err = SetVariableFromAny(interp, nameObjPtr)) != JIM_OK) {
/* Check for [dict] syntax sugar. */
if (err == JIM_DICT_SUGAR)
return copy;
}
-int JimReferencesHTKeyCompare(void *privdata, const void *key1,
+int JimReferencesHTKeyCompare(void *privdata, const void *key1,
const void *key2)
{
JIM_NOTUSED(privdata);
&objPtr->internalRep.refValue.id, NULL);
#ifdef JIM_DEBUG_GC
Jim_fprintf(interp,interp->cookie_stdout,
- "MARK (reference): %d refcount: %d" JIM_NL,
+ "MARK (reference): %d refcount: %d" JIM_NL,
(int) objPtr->internalRep.refValue.id,
objPtr->refCount);
#endif
{
jim_wide elapsedId;
int elapsedTime;
-
+
elapsedId = interp->referenceNextId - interp->lastCollectId;
elapsedTime = time(NULL) - interp->lastCollectTime;
* there is a memory leak. */
if (i->liveList != NULL) {
Jim_Obj *objPtr = i->liveList;
-
+
Jim_fprintf(i, i->cookie_stdout,JIM_NL "-------------------------------------" JIM_NL);
Jim_fprintf(i, i->cookie_stdout,"Objects still in the free list:" JIM_NL);
while (objPtr) {
return JIM_OK;
}
-Jim_Obj *Jim_NewListObj(Jim_Interp *interp, Jim_Obj *const *elements,
+Jim_Obj *Jim_NewListObj(Jim_Interp *interp, Jim_Obj *const *elements,
int len)
{
Jim_Obj *objPtr;
SetListFromAny(interp, listPtr);
if (index >= 0 && index > listPtr->internalRep.listValue.len)
index = listPtr->internalRep.listValue.len;
- else if (index < 0)
+ else if (index < 0)
index = 0;
Jim_InvalidateStringRep(listPtr);
ListInsertElements(listPtr, index, objc, objVec);
if (*pc->p == '-') {
pc->p++; pc->len--;
}
- while (isdigit((int)*pc->p)
+ while (isdigit((int)*pc->p)
|| (allowhex && isxdigit((int)*pc->p))
- || (allowdot && *pc->p == '.')
+ || (allowdot && *pc->p == '.')
|| (pc->p-pc->tstart == 1 && *pc->tstart == '0' &&
(*pc->p == 'x' || *pc->p == 'X'))
)
* to be parsed in its entirely first and then, if correct, can be used for
* scanning. To avoid endless re-parsing, the parsed representation will be
* stored in an internal representation and re-used for performance reason. */
-
+
/* A ScanFmtPartDescr will held the information of /one/ part of the whole
* scanformat string. This part will later be used to extract information
* out from the string to be parsed by Jim_ScanString */
-
+
typedef struct ScanFmtPartDescr {
char type; /* Type of conversion (e.g. c, d, f) */
char modifier; /* Modify type (e.g. l - long, h - short */
size_t width; /* Maximal width of input to be converted */
- int pos; /* -1 - no assign, 0 - natural pos, >0 - XPG3 pos */
+ int pos; /* -1 - no assign, 0 - natural pos, >0 - XPG3 pos */
char *arg; /* Specification of a CHARSET conversion */
char *prefix; /* Prefix to be scanned literally before conversion */
} ScanFmtPartDescr;
int width = 0, skip;
ScanFmtPartDescr *descr = &fmtObj->descr[curr];
fmtObj->count++;
- descr->width = 0; /* Assume width unspecified */
+ descr->width = 0; /* Assume width unspecified */
/* Overread and store any "literal" prefix */
if (*fmt != '%' || fmt[1] == '%') {
descr->type = 0;
buffer[i++] = *fmt;
}
buffer[i++] = 0;
- }
+ }
/* Skip the conversion introducing '%' sign */
- ++fmt;
+ ++fmt;
/* End reached due to non-conversion literal only? */
if (fmt >= fmtEnd)
goto done;
if (*fmt != ']') {
fmtObj->error = "unmatched [ in format string";
return JIM_ERR;
- }
+ }
end = i;
buffer[i++] = 0;
/* In case a range fence was given "backwards", swap it */
/* Remember any valid modifier if given */
if (strchr("hlL", *fmt) != 0)
descr->modifier = tolower((int)*fmt++);
-
+
descr->type = *fmt;
if (strchr("efgcsndoxui", *fmt) == 0) {
fmtObj->error = "bad scan conversion character";
((ScanFmtStringObj*)((_fo_)->internalRep.ptr))->error
/* Some Bit testing/setting/cleaning routines. For now only used in handling
- * charsets ([a-z123]) within scanning. Later on perhaps a base for a
- * bitvector implementation in Jim? */
+ * charsets ([a-z123]) within scanning. Later on perhaps a base for a
+ * bitvector implementation in Jim? */
static int JimTestBit(const char *bitvec, char ch)
{
memset(charset, (sdescr ? 0 : 255), sizeof(charset));
if (sdescr) {
/* There was a set description given, that means we are parsing
- * a specified string. So we have to build a corresponding
+ * a specified string. So we have to build a corresponding
* charset reflecting the description */
int notFlag = 0;
/* Should the set be negated at the end? */
/* Negate the charset if there was a NOT given */
for (i = 0; notFlag && i < sizeof(charset); ++i)
charset[i] = ~charset[i];
- }
+ }
/* And after all the mess above, the real work begin ... */
while (str && *str) {
if (!sdescr && isspace((int)*str))
/* If prefix require, skip WS */
if (isspace((int)descr->prefix[i]))
while (str[pos] && isspace((int)str[pos])) ++pos;
- else if (descr->prefix[i] != str[pos])
+ else if (descr->prefix[i] != str[pos])
break; /* Prefix do not match here, leave the loop */
else
++pos; /* Prefix matched so far, next round */
: descr->type == 'x' ? 16
: descr->type == 'i' ? 0
: 10;
-
+
do {
/* Try to scan a number with the given base */
if (descr->modifier == 'l')
}
/* If scanning failed, and base was undetermined, simply
* put it to 10 and try once more. This should catch the
- * case where %i begin to parse a number prefix (e.g.
+ * case where %i begin to parse a number prefix (e.g.
* '0x' but no further digits follows. This will be
* handled as a ZERO followed by a char 'x' by Tcl */
if (endp == tok && base == 0) base = 10;
#ifdef JIM_DYNLIB
#ifdef WIN32
#define RTLD_LAZY 0
-void * dlopen(const char *path, int mode)
+void * dlopen(const char *path, int mode)
{
JIM_NOTUSED(mode);
const char *prefix;
int prefixlen;
Jim_Obj *prefixObjPtr;
-
+
buf[0] = '\0';
if (Jim_ListIndex(interp, libPathObjPtr, i,
&prefixObjPtr, JIM_NONE) != JIM_OK)
continue;
if (*pathName == '/') {
strcpy(buf, pathName);
- }
+ }
else if (prefixlen && prefix[prefixlen-1] == '/')
sprintf(buf, "%s%s", prefix, pathName);
else
#define JIM_PKG_ANY_VERSION -1
/* Convert a string of the type "1.2" into an integer.
- * MAJOR.MINOR is converted as MAJOR*100 + MINOR, so "1.2" is converted
+ * MAJOR.MINOR is converted as MAJOR*100 + MINOR, so "1.2" is converted
* to the integer with value 102 */
static int JimPackageVersionToInt(Jim_Interp *interp, const char *v,
int *intPtr, int flags)
int nread, totread, maxlen, buflen;
int retval;
Jim_Obj *scriptObjPtr;
-
+
if ((fp = fopen(filename, "r")) == NULL) {
const int cwd_len = 2048;
char *cwd = malloc(cwd_len);
* that's: $foo($bar) */
if (script->len == 1 && script->token[0].type == JIM_TT_VAR) {
Jim_Obj *varObjPtr = script->token[0].objPtr;
-
+
Jim_IncrRefCount(varObjPtr);
resObjPtr = Jim_GetVariable(interp, varObjPtr, JIM_ERRMSG);
if (resObjPtr == NULL) {
* to return. */
savedResultObjPtr = interp->result;
Jim_IncrRefCount(savedResultObjPtr);
-
+
/* Perform the substitution. Starts with an empty object
* and adds every token (performing the appropriate
* var/command/escape substitution). */
JIM_REGISTER_API(GetOpt_Nvp);
JIM_REGISTER_API(GetOpt_NvpUnknown);
JIM_REGISTER_API(GetOpt_Enum);
-
+
JIM_REGISTER_API(Debug_ArgvString);
JIM_REGISTER_API(SetResult_sprintf);
JIM_REGISTER_API(SetResult_NvpUnknown);
/* -----------------------------------------------------------------------------
* Core commands utility functions
* ---------------------------------------------------------------------------*/
-void Jim_WrongNumArgs(Jim_Interp *interp, int argc, Jim_Obj *const *argv,
+void Jim_WrongNumArgs(Jim_Interp *interp, int argc, Jim_Obj *const *argv,
const char *msg)
{
int i;
Jim_Obj *listObjPtr = Jim_NewListObj(interp, NULL, 0);
const char *pattern;
int patternLen;
-
+
pattern = patternObjPtr ? Jim_GetString(patternObjPtr, &patternLen) : NULL;
htiter = Jim_GetHashTableIterator(&interp->commands);
while ((he = Jim_NextHashEntry(htiter)) != NULL) {
- if (pattern && !JimStringMatch(pattern, patternLen, he->key,
+ if (pattern && !JimStringMatch(pattern, patternLen, he->key,
strlen((const char*)he->key), 0))
continue;
Jim_ListAppendElement(interp, listObjPtr,
Jim_Obj *listObjPtr = Jim_NewListObj(interp, NULL, 0);
const char *pattern;
int patternLen;
-
+
pattern = patternObjPtr ? Jim_GetString(patternObjPtr, &patternLen) : NULL;
if (mode == JIM_VARLIST_GLOBALS) {
htiter = Jim_GetHashTableIterator(&interp->topFramePtr->vars);
if (varPtr->linkFramePtr != NULL)
continue;
}
- if (pattern && !JimStringMatch(pattern, patternLen, he->key,
+ if (pattern && !JimStringMatch(pattern, patternLen, he->key,
strlen((const char*)he->key), 0))
continue;
Jim_ListAppendElement(interp, listObjPtr,
{
const char *str;
int len, nonewline = 0;
-
+
if (argc != 2 && argc != 3) {
Jim_WrongNumArgs(interp, 1, argv, "-nonewline string");
return JIM_ERR;
}
/* Helper for [+] and [*] */
-static int Jim_AddMulHelper(Jim_Interp *interp, int argc,
+static int Jim_AddMulHelper(Jim_Interp *interp, int argc,
Jim_Obj *const *argv, int op)
{
jim_wide wideValue, res;
int i;
res = (op == JIM_EXPROP_ADD) ? 0 : 1;
-
+
for (i = 1; i < argc; i++) {
if (Jim_GetWide(interp, argv[i], &wideValue) != JIM_OK)
goto trydouble;
}
/* Helper for [-] and [/] */
-static int Jim_SubDivHelper(Jim_Interp *interp, int argc,
+static int Jim_SubDivHelper(Jim_Interp *interp, int argc,
Jim_Obj *const *argv, int op)
{
jim_wide wideValue, res = 0;
}
/* [unset] */
-static int Jim_UnsetCoreCommand(Jim_Interp *interp, int argc,
+static int Jim_UnsetCoreCommand(Jim_Interp *interp, int argc,
Jim_Obj *const *argv)
{
int i;
}
/* [incr] */
-static int Jim_IncrCoreCommand(Jim_Interp *interp, int argc,
+static int Jim_IncrCoreCommand(Jim_Interp *interp, int argc,
Jim_Obj *const *argv)
{
jim_wide wideValue, increment = 1;
}
/* [while] */
-static int Jim_WhileCoreCommand(Jim_Interp *interp, int argc,
+static int Jim_WhileCoreCommand(Jim_Interp *interp, int argc,
Jim_Obj *const *argv)
{
if (argc != 3) {
/* STEP 1 -- Check if there are the conditions to run the specialized
* version of while */
-
+
if ((expr = Jim_GetExpression(interp, argv[1])) == NULL) goto noopt;
if (expr->len <= 0 || expr->len > 3) goto noopt;
switch (expr->len) {
}
/* [for] */
-static int Jim_ForCoreCommand(Jim_Interp *interp, int argc,
+static int Jim_ForCoreCommand(Jim_Interp *interp, int argc,
Jim_Obj *const *argv)
{
int retval;
}
/* foreach + lmap implementation. */
-static int JimForeachMapHelper(Jim_Interp *interp, int argc,
+static int JimForeachMapHelper(Jim_Interp *interp, int argc,
Jim_Obj *const *argv, int doMap)
{
int result = JIM_ERR, i, nbrOfLists, *listsIdx, *listsEnd;
Jim_SetResultString(interp, "couldn't set loop variable: ", -1);
goto err;
}
- ++listsIdx[i]; /* Remember next iterator of current list */
+ ++listsIdx[i]; /* Remember next iterator of current list */
} else if (Jim_SetVariable(interp, varName, emptyStr) != JIM_OK) {
Jim_SetResultString(interp, "couldn't set loop variable: ", -1);
goto err;
}
/* [foreach] */
-static int Jim_ForeachCoreCommand(Jim_Interp *interp, int argc,
+static int Jim_ForeachCoreCommand(Jim_Interp *interp, int argc,
Jim_Obj *const *argv)
{
return JimForeachMapHelper(interp, argc, argv, 0);
}
/* [lmap] */
-static int Jim_LmapCoreCommand(Jim_Interp *interp, int argc,
+static int Jim_LmapCoreCommand(Jim_Interp *interp, int argc,
Jim_Obj *const *argv)
{
return JimForeachMapHelper(interp, argc, argv, 1);
}
/* [if] */
-static int Jim_IfCoreCommand(Jim_Interp *interp, int argc,
+static int Jim_IfCoreCommand(Jim_Interp *interp, int argc,
Jim_Obj *const *argv)
{
int boolean, retval, current = 1, falsebody = 0;
return Jim_EvalObj(interp, argv[current]);
/* Ok: no else-clause follows */
if (++current >= argc) {
- Jim_SetResult(interp, Jim_NewEmptyStringObj(interp));
+ Jim_SetResult(interp, Jim_NewEmptyStringObj(interp));
return JIM_OK;
}
falsebody = current++;
enum {SWITCH_EXACT, SWITCH_GLOB, SWITCH_RE, SWITCH_CMD, SWITCH_UNKNOWN};
/* [switch] */
-static int Jim_SwitchCoreCommand(Jim_Interp *interp, int argc,
+static int Jim_SwitchCoreCommand(Jim_Interp *interp, int argc,
Jim_Obj *const *argv)
{
int retcode = JIM_ERR, matchOpt = SWITCH_EXACT, opt = 1, patCount, i;
else if (strncmp(option, "-regexp", 2) == 0) matchOpt = SWITCH_RE;
else if (strncmp(option, "-command", 2) == 0) { matchOpt = SWITCH_CMD;
if ((argc - opt) < 2) goto wrongnumargs;
- command = argv[++opt];
+ command = argv[++opt];
} else {
Jim_SetResult(interp, Jim_NewEmptyStringObj(interp));
Jim_AppendStrings(interp, Jim_GetResult(interp),
"bad option \"", option, "\": must be -exact, -glob, "
"-regexp, -command procname or --", 0);
- goto err;
+ goto err;
}
if ((argc - opt) < 2) goto wrongnumargs;
}
"pattern body ... ?default body? or "
"{pattern body ?pattern body ...?}");
err:
- return retcode;
+ return retcode;
}
/* [list] */
-static int Jim_ListCoreCommand(Jim_Interp *interp, int argc,
+static int Jim_ListCoreCommand(Jim_Interp *interp, int argc,
Jim_Obj *const *argv)
{
Jim_Obj *listObjPtr;
}
/* [lindex] */
-static int Jim_LindexCoreCommand(Jim_Interp *interp, int argc,
+static int Jim_LindexCoreCommand(Jim_Interp *interp, int argc,
Jim_Obj *const *argv)
{
Jim_Obj *objPtr, *listObjPtr;
}
/* [llength] */
-static int Jim_LlengthCoreCommand(Jim_Interp *interp, int argc,
+static int Jim_LlengthCoreCommand(Jim_Interp *interp, int argc,
Jim_Obj *const *argv)
{
int len;
}
/* [lappend] */
-static int Jim_LappendCoreCommand(Jim_Interp *interp, int argc,
+static int Jim_LappendCoreCommand(Jim_Interp *interp, int argc,
Jim_Obj *const *argv)
{
Jim_Obj *listObjPtr;
}
/* [linsert] */
-static int Jim_LinsertCoreCommand(Jim_Interp *interp, int argc,
+static int Jim_LinsertCoreCommand(Jim_Interp *interp, int argc,
Jim_Obj *const *argv)
{
int index, len;
}
/* [lset] */
-static int Jim_LsetCoreCommand(Jim_Interp *interp, int argc,
+static int Jim_LsetCoreCommand(Jim_Interp *interp, int argc,
Jim_Obj *const *argv)
{
if (argc < 3) {
}
/* [append] */
-static int Jim_AppendCoreCommand(Jim_Interp *interp, int argc,
+static int Jim_AppendCoreCommand(Jim_Interp *interp, int argc,
Jim_Obj *const *argv)
{
Jim_Obj *stringObjPtr;
}
/* [debug] */
-static int Jim_DebugCoreCommand(Jim_Interp *interp, int argc,
+static int Jim_DebugCoreCommand(Jim_Interp *interp, int argc,
Jim_Obj *const *argv)
{
const char *options[] = {
}
/* [eval] */
-static int Jim_EvalCoreCommand(Jim_Interp *interp, int argc,
+static int Jim_EvalCoreCommand(Jim_Interp *interp, int argc,
Jim_Obj *const *argv)
{
if (argc == 2) {
}
/* [uplevel] */
-static int Jim_UplevelCoreCommand(Jim_Interp *interp, int argc,
+static int Jim_UplevelCoreCommand(Jim_Interp *interp, int argc,
Jim_Obj *const *argv)
{
if (argc >= 2) {
}
/* [expr] */
-static int Jim_ExprCoreCommand(Jim_Interp *interp, int argc,
+static int Jim_ExprCoreCommand(Jim_Interp *interp, int argc,
Jim_Obj *const *argv)
{
Jim_Obj *exprResultPtr;
}
/* [break] */
-static int Jim_BreakCoreCommand(Jim_Interp *interp, int argc,
+static int Jim_BreakCoreCommand(Jim_Interp *interp, int argc,
Jim_Obj *const *argv)
{
if (argc != 1) {
}
/* [return] */
-static int Jim_ReturnCoreCommand(Jim_Interp *interp, int argc,
+static int Jim_ReturnCoreCommand(Jim_Interp *interp, int argc,
Jim_Obj *const *argv)
{
if (argc == 1) {
}
/* [proc] */
-static int Jim_ProcCoreCommand(Jim_Interp *interp, int argc,
+static int Jim_ProcCoreCommand(Jim_Interp *interp, int argc,
Jim_Obj *const *argv)
{
int argListLen;
const char *str;
int len;
Jim_Obj *argPtr;
-
+
/* Check for 'args' and adjust arityMin and arityMax if necessary */
Jim_ListIndex(interp, argv[2], argListLen-1, &argPtr, JIM_NONE);
str = Jim_GetString(argPtr, &len);
}
/* [concat] */
-static int Jim_ConcatCoreCommand(Jim_Interp *interp, int argc,
+static int Jim_ConcatCoreCommand(Jim_Interp *interp, int argc,
Jim_Obj *const *argv)
{
Jim_SetResult(interp, Jim_ConcatObj(interp, argc-1, argv + 1));
}
/* [upvar] */
-static int Jim_UpvarCoreCommand(Jim_Interp *interp, int argc,
+static int Jim_UpvarCoreCommand(Jim_Interp *interp, int argc,
Jim_Obj *const *argv)
{
const char *str;
/* Lookup the target frame pointer */
str = Jim_GetString(argv[1], NULL);
- if (argc > 3 &&
+ if (argc > 3 &&
((str[0] >= '0' && str[0] <= '9') || str[0] == '#'))
{
if (Jim_GetCallFrameByLevel(interp, argv[1],
}
/* [global] */
-static int Jim_GlobalCoreCommand(Jim_Interp *interp, int argc,
+static int Jim_GlobalCoreCommand(Jim_Interp *interp, int argc,
Jim_Obj *const *argv)
{
int i;
Jim_Obj **value;
int *keyLen, strLen, i;
Jim_Obj *resultObjPtr;
-
+
Jim_ListLength(interp, mapListObjPtr, &numMaps);
if (numMaps % 2) {
Jim_SetResultString(interp,
}
/* [string] */
-static int Jim_StringCoreCommand(Jim_Interp *interp, int argc,
+static int Jim_StringCoreCommand(Jim_Interp *interp, int argc,
Jim_Obj *const *argv)
{
int option;
}
/* [time] */
-static int Jim_TimeCoreCommand(Jim_Interp *interp, int argc,
+static int Jim_TimeCoreCommand(Jim_Interp *interp, int argc,
Jim_Obj *const *argv)
{
long i, count = 1;
}
/* [exit] */
-static int Jim_ExitCoreCommand(Jim_Interp *interp, int argc,
+static int Jim_ExitCoreCommand(Jim_Interp *interp, int argc,
Jim_Obj *const *argv)
{
long exitCode = 0;
}
/* [catch] */
-static int Jim_CatchCoreCommand(Jim_Interp *interp, int argc,
+static int Jim_CatchCoreCommand(Jim_Interp *interp, int argc,
Jim_Obj *const *argv)
{
int exitCode = 0;
}
/* [ref] */
-static int Jim_RefCoreCommand(Jim_Interp *interp, int argc,
+static int Jim_RefCoreCommand(Jim_Interp *interp, int argc,
Jim_Obj *const *argv)
{
if (argc != 3 && argc != 4) {
}
/* [getref] */
-static int Jim_GetrefCoreCommand(Jim_Interp *interp, int argc,
+static int Jim_GetrefCoreCommand(Jim_Interp *interp, int argc,
Jim_Obj *const *argv)
{
Jim_Reference *refPtr;
}
/* [setref] */
-static int Jim_SetrefCoreCommand(Jim_Interp *interp, int argc,
+static int Jim_SetrefCoreCommand(Jim_Interp *interp, int argc,
Jim_Obj *const *argv)
{
Jim_Reference *refPtr;
}
/* [collect] */
-static int Jim_CollectCoreCommand(Jim_Interp *interp, int argc,
+static int Jim_CollectCoreCommand(Jim_Interp *interp, int argc,
Jim_Obj *const *argv)
{
if (argc != 1) {
}
/* [finalize] reference ?newValue? */
-static int Jim_FinalizeCoreCommand(Jim_Interp *interp, int argc,
+static int Jim_FinalizeCoreCommand(Jim_Interp *interp, int argc,
Jim_Obj *const *argv)
{
if (argc != 2 && argc != 3) {
/* [info references] (list of all the references/finalizers) */
/* [rename] */
-static int Jim_RenameCoreCommand(Jim_Interp *interp, int argc,
+static int Jim_RenameCoreCommand(Jim_Interp *interp, int argc,
Jim_Obj *const *argv)
{
const char *oldName, *newName;
}
/* [dict] */
-static int Jim_DictCoreCommand(Jim_Interp *interp, int argc,
+static int Jim_DictCoreCommand(Jim_Interp *interp, int argc,
Jim_Obj *const *argv)
{
int option;
}
/* [load] */
-static int Jim_LoadCoreCommand(Jim_Interp *interp, int argc,
+static int Jim_LoadCoreCommand(Jim_Interp *interp, int argc,
Jim_Obj *const *argv)
{
if (argc < 2) {
}
/* [subst] */
-static int Jim_SubstCoreCommand(Jim_Interp *interp, int argc,
+static int Jim_SubstCoreCommand(Jim_Interp *interp, int argc,
Jim_Obj *const *argv)
{
int i, flags = 0;
}
/* [info] */
-static int Jim_InfoCoreCommand(Jim_Interp *interp, int argc,
+static int Jim_InfoCoreCommand(Jim_Interp *interp, int argc,
Jim_Obj *const *argv)
{
int cmd, result = JIM_OK;
};
enum {INFO_BODY, INFO_COMMANDS, INFO_EXISTS, INFO_GLOBALS, INFO_LEVEL,
INFO_LOCALS, INFO_VARS, INFO_VERSION, INFO_COMPLETE, INFO_ARGS, INFO_HOSTNAME};
-
+
if (argc < 2) {
Jim_WrongNumArgs(interp, 1, argv, "command ?args ...?");
return JIM_ERR;
!= JIM_OK) {
return JIM_ERR;
}
-
+
if (cmd == INFO_COMMANDS) {
if (argc != 2 && argc != 3) {
Jim_WrongNumArgs(interp, 2, argv, "?pattern?");
Jim_SetResult(interp, cmdPtr->argListObjPtr);
} else if (cmd == INFO_VERSION) {
char buf[(JIM_INTEGER_SPACE * 2) + 1];
- sprintf(buf, "%d.%d",
+ sprintf(buf, "%d.%d",
JIM_VERSION / 100, JIM_VERSION % 100);
Jim_SetResultString(interp, buf, -1);
} else if (cmd == INFO_COMPLETE) {
}
/* [split] */
-static int Jim_SplitCoreCommand(Jim_Interp *interp, int argc,
+static int Jim_SplitCoreCommand(Jim_Interp *interp, int argc,
Jim_Obj *const *argv)
{
const char *str, *splitChars, *noMatchStart;
memset(objCache, 0, sizeof(objCache));
for (i = 0; i < strLen; i++) {
int c = u[i];
-
+
if (objCache[c] == NULL)
objCache[c] = Jim_NewStringObj(interp, (char*)u + i, 1);
Jim_ListAppendElement(interp, resObjPtr, objCache[c]);
}
/* [join] */
-static int Jim_JoinCoreCommand(Jim_Interp *interp, int argc,
+static int Jim_JoinCoreCommand(Jim_Interp *interp, int argc,
Jim_Obj *const *argv)
{
const char *joinStr;
if (argc < 3) {
Jim_WrongNumArgs(interp, 1, argv, "string formatString ?varName ...?");
return JIM_ERR;
- }
+ }
if (argv[2]->typePtr != &scanFmtStringObjType)
SetScanFmtFromAny(interp, argv[2]);
if (FormatGetError(argv[2]) != 0) {
"field specifiers", -1);
return JIM_ERR;
}
- }
+ }
listPtr = Jim_ScanString(interp, argv[1], argv[2], JIM_ERRMSG);
if (listPtr == 0)
return JIM_ERR;
}
/* [package] */
-static int Jim_PackageCoreCommand(Jim_Interp *interp, int argc,
+static int Jim_PackageCoreCommand(Jim_Interp *interp, int argc,
Jim_Obj *const *argv)
{
int option;
int i = 0;
while (Jim_CoreCommandsTable[i].name != NULL) {
- Jim_CreateCommand(interp,
+ Jim_CreateCommand(interp,
Jim_CoreCommandsTable[i].name,
Jim_CoreCommandsTable[i].cmdProc,
NULL, NULL);
}
int
-Jim_Nvp_name2value_obj(Jim_Interp *interp,
- const Jim_Nvp *p,
- Jim_Obj *o,
+Jim_Nvp_name2value_obj(Jim_Interp *interp,
+ const Jim_Nvp *p,
+ Jim_Obj *o,
Jim_Nvp **result)
{
return Jim_Nvp_name2value(interp, p, Jim_GetString(o, NULL), result);
}
-
-int
-Jim_Nvp_name2value(Jim_Interp *interp,
- const Jim_Nvp *_p,
- const char *name,
+
+int
+Jim_Nvp_name2value(Jim_Interp *interp,
+ const Jim_Nvp *_p,
+ const char *name,
Jim_Nvp **result)
{
const Jim_Nvp *p;
if (result) {
*result = (Jim_Nvp *)(p);
}
-
+
/* found? */
if (p->name) {
return JIM_OK;
}
-int
+int
Jim_Nvp_value2name_obj(Jim_Interp *interp, const Jim_Nvp *p, Jim_Obj *o, Jim_Nvp **result)
{
int e;;
}
-int
+int
Jim_Nvp_value2name(Jim_Interp *interp, const Jim_Nvp *_p, int value, Jim_Nvp **result)
{
const Jim_Nvp *p;
Jim_fprintf(p->interp, p->interp->cookie_stderr, "---args---\n");
for (x = 0 ; x < p->argc ; x++) {
- Jim_fprintf(p->interp, p->interp->cookie_stderr,
- "%2d) %s\n",
- x,
+ Jim_fprintf(p->interp, p->interp->cookie_stderr,
+ "%2d) %s\n",
+ x,
Jim_GetString(p->argv[x], NULL));
}
Jim_fprintf(p->interp, p->interp->cookie_stderr, "-------\n");
Jim_GetOpt_Obj(Jim_GetOptInfo *goi, Jim_Obj **puthere)
{
Jim_Obj *o;
-
- o = NULL; // failure
+
+ o = NULL; // failure
if (goi->argc) {
- // success
+ // success
o = goi->argv[0];
goi->argc -= 1;
goi->argv += 1;
int r;
Jim_Obj *o;
double _safe;
-
+
if (puthere == NULL) {
puthere = &_safe;
}
r = Jim_GetDouble(goi->interp, o, puthere);
if (r != JIM_OK) {
Jim_SetResult_sprintf(goi->interp,
- "not a number: %s",
+ "not a number: %s",
Jim_GetString(o, NULL));
}
}
return r;
}
-int Jim_GetOpt_Nvp(Jim_GetOptInfo *goi,
- const Jim_Nvp *nvp,
+int Jim_GetOpt_Nvp(Jim_GetOptInfo *goi,
+ const Jim_Nvp *nvp,
Jim_Nvp **puthere)
{
Jim_Nvp *_safe;
e = Jim_GetOpt_Obj(goi, &o);
if (e == JIM_OK) {
e = Jim_Nvp_name2value_obj(goi->interp,
- nvp,
+ nvp,
o,
puthere);
}
nvptable);
}
}
-
-int
+
+int
Jim_GetOpt_Enum(Jim_GetOptInfo *goi,
const char * const * lookup,
int *puthere)
}
return e;
}
-
+
int
}
return JIM_OK;
}
-
+
void
-Jim_SetResult_NvpUnknown(Jim_Interp *interp,
+Jim_SetResult_NvpUnknown(Jim_Interp *interp,
Jim_Obj *param_name,
Jim_Obj *param_value,
const Jim_Nvp *nvp)
nvp++;
}
}
-
+
static Jim_Obj *debug_string_obj;
*
* 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
* 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
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;
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);
* };
*
* 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];
const char *name;
int value;
} Jim_Nvp;
-
+
/* -----------------------------------------------------------------------------
* Exported API prototypes.
#define Jim_FreeHashTableIterator(iter) Jim_Free(iter)
#ifdef DOXYGEN
-#define JIM_STATIC
+#define JIM_STATIC
#define JIM_API(X) X
#else
#ifndef __JIM_CORE__
/* 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);
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);
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);
/* 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 */
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:
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...
*
typedef struct jim_getopt {
Jim_Interp *interp;
- int argc;
+ int argc;
Jim_Obj * const * argv;
int isconfigure; /* non-zero if configure */
} Jim_GetOptInfo;
*
* Example (short and incomplete):
* \code
- * Jim_GetOptInfo goi;
+ * Jim_GetOptInfo goi;
*
* Jim_GetOpt_Setup(&goi, interp, argc, argv);
*
* }
*
* \endcode
- *
+ *
*/
-/** Setup GETOPT
+/** Setup GETOPT
*
* \param goi - get opt info to be initialized
* \param interp - jim interp
*
* \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);
*
* \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);
* \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
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);
#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.
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);
#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)
#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
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, "\\..");
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:
{
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
LOG_OUTPUT("--command | -c\trun <command>\n");
LOG_OUTPUT("--pipe | -p\tuse pipes for gdb communication\n");
exit(-1);
- }
+ }
if (version_flag)
{
// It is not an error to request the VERSION number.
exit(0);
}
-
+
return ERROR_OK;
}
#include <stdlib.h>
#include <string.h>
-/*
+/*
* clear_malloc
*
* will alloc memory and clear it
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 */
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 */
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;
}
{
result->tv_sec += sec;
result->tv_usec += usec;
-
+
while (result->tv_usec > 1000000)
{
result->tv_usec -= 1000000;
result->tv_sec++;
}
-
+
return 0;
}
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;
*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;
}
if (result == 0)
{
unsigned int u_tg = buf_get_u32(usb_in_buffer, 0, 16);
- LOG_INFO("U_tg = %d mV, U_aux = %d mV, U_tgpwr = %d mV, I_tgpwr = %d mA, D1 = %d, Target power %s %s\n",
+ LOG_INFO("U_tg = %d mV, U_aux = %d mV, U_tgpwr = %d mV, I_tgpwr = %d mA, D1 = %d, Target power %s %s\n",
(int)(buf_get_u32(usb_in_buffer + 0, 0, 16)),
(int)(buf_get_u32(usb_in_buffer + 2, 0, 16)),
(int)(buf_get_u32(usb_in_buffer + 4, 0, 16)),
(int)(buf_get_u32(usb_in_buffer + 6, 0, 16)),
- usb_in_buffer[9],
- usb_in_buffer[11] ? "OVERCURRENT" : "OK",
+ usb_in_buffer[9],
+ usb_in_buffer[11] ? "OVERCURRENT" : "OK",
usb_in_buffer[10] ? "enabled" : "disabled");
if (u_tg < 1500)
log_printf_lf(level, __FILE__, __LINE__, __FUNCTION__,
"JTAG tap: %s %16.16s: 0x%08x "
"(mfg: 0x%3.3x, part: 0x%4.4x, ver: 0x%1.1x)",
- name, msg,
+ name, msg,
(unsigned int)idcode,
- (unsigned int)EXTRACT_MFG(idcode),
- (unsigned int)EXTRACT_PART(idcode),
+ (unsigned int)EXTRACT_MFG(idcode),
+ (unsigned int)EXTRACT_PART(idcode),
(unsigned int)EXTRACT_VER(idcode));
}
{
jtag_unregister_event_callback(&jtag_reset_callback, tap);
- /// @todo is anything missing? no memory leaks please
+ /// @todo is anything missing? no memory leaks please
free((void *)tap->expected_ids);
free((void *)tap->chip);
free((void *)tap->tapname);
if (*bytes_read < size)
{
- LOG_ERROR("couldn't read the requested number of bytes from FT2232 device (%i < %i)",
- (unsigned int)(*bytes_read),
+ LOG_ERROR("couldn't read the requested number of bytes from FT2232 device (%i < %i)",
+ (unsigned int)(*bytes_read),
(unsigned int)size);
return ERROR_JTAG_DEVICE_ERROR;
}
LOG_ERROR("couldn't write MPSSE commands to FT2232");
exit(-1);
}
- LOG_DEBUG("ft2232_buffer_size: %i, bytes_written: %i",
+ LOG_DEBUG("ft2232_buffer_size: %i, bytes_written: %i",
ft2232_buffer_size, (int)bytes_written);
ft2232_buffer_size = 0;
LOG_ERROR("couldn't write MPSSE commands to FT2232");
exit(-1);
}
- LOG_DEBUG("ft2232_buffer_size: %i, bytes_written: %i",
- ft2232_buffer_size,
+ LOG_DEBUG("ft2232_buffer_size: %i, bytes_written: %i",
+ ft2232_buffer_size,
(int)bytes_written);
ft2232_buffer_size = 0;
LOG_ERROR("couldn't read from FT2232");
exit(-1);
}
- LOG_DEBUG("thisrun_read: %i, bytes_read: %i",
- thisrun_read,
+ LOG_DEBUG("thisrun_read: %i, bytes_read: %i",
+ thisrun_read,
(int)bytes_read);
receive_pointer += bytes_read;
}
LOG_ERROR("couldn't write MPSSE commands to FT2232");
exit(-1);
}
- LOG_DEBUG("ft2232_buffer_size: %i, bytes_written: %i",
- ft2232_buffer_size,
+ LOG_DEBUG("ft2232_buffer_size: %i, bytes_written: %i",
+ ft2232_buffer_size,
(int)bytes_written);
ft2232_buffer_size = 0;
LOG_ERROR("couldn't read from FT2232");
exit(-1);
}
- LOG_DEBUG("thisrun_read: %i, bytes_read: %i",
- thisrun_read,
+ LOG_DEBUG("thisrun_read: %i, bytes_read: %i",
+ thisrun_read,
(int)bytes_read);
receive_pointer += bytes_read;
}
* - jtag_add_callback
* - jtag_add_callback4
* - interface_jtag_add_dr_out
- *
+ *
* The following core functions are declared in this file for use by
* the minidriver and do @b not need to be defined by an implementation:
* - default_interface_jtag_execute_queue()
if (ftbytes != size)
{
- LOG_ERROR("couldn't write the requested number of bytes to PRESTO (%u < %u)",
+ LOG_ERROR("couldn't write the requested number of bytes to PRESTO (%u < %u)",
(unsigned)ftbytes, (unsigned)size);
return ERROR_JTAG_DEVICE_ERROR;
}
if (ftbytes != size)
{
/* this is just a warning, there might have been timeout when detecting PRESTO, which is not fatal */
- LOG_WARNING("couldn't read the requested number of bytes from PRESTO (%u < %u)",
+ LOG_WARNING("couldn't read the requested number of bytes from PRESTO (%u < %u)",
(unsigned)ftbytes, (unsigned)size);
return ERROR_JTAG_DEVICE_ERROR;
}
connection_t *c, **p;
int retval;
int flag = 1;
-
+
c = malloc(sizeof(connection_t));
c->fd = -1;
memset(&c->sin, 0, sizeof(c->sin));
if (service->type == CONNECTION_TCP)
{
address_size = sizeof(c->sin);
-
+
c->fd = accept(service->fd, (struct sockaddr *)&service->sin, &address_size);
-
+
/* This increases performance dramatically for e.g. GDB load which
* does not have a sliding window protocol. */
retval = setsockopt(c->fd, /* socket affected */
TCP_NODELAY, /* name of option */
(char *)&flag, /* the cast is historical cruft */
sizeof(int)); /* length of option value */
-
+
LOG_INFO("accepting '%s' connection from %i", service->name, c->sin.sin_port);
if ((retval = service->new_connection(c)) != ERROR_OK)
{
else if (service->type == CONNECTION_PIPE)
{
c->fd = service->fd;
-
+
/* do not check for new connections again on stdin */
service->fd = -1;
-
+
LOG_INFO("accepting '%s' connection from pipe", service->name);
if ((retval = service->new_connection(c)) != ERROR_OK)
{
return retval;
}
}
-
+
/* add to the end of linked list */
for (p = &service->connections; *p; p = &(*p)->next);
*p = c;
-
+
service->max_connections--;
-
+
return ERROR_OK;
}
{
connection_t **p = &service->connections;
connection_t *c;
-
+
/* find connection */
while ((c = *p))
- {
+ {
if (c->fd == connection->fd)
- {
+ {
service->connection_closed(c);
if (service->type == CONNECTION_TCP)
close_socket(c->fd);
command_done(c->cmd_ctx);
-
+
/* delete connection */
*p = c->next;
free(c);
-
+
service->max_connections++;
break;
}
-
+
/* redirect p to next list pointer */
- p = &(*p)->next;
+ p = &(*p)->next;
}
-
+
return ERROR_OK;
}
{
service_t *c, **p;
int so_reuseaddr_option = 1;
-
+
c = malloc(sizeof(service_t));
-
+
c->name = strdup(name);
c->type = type;
c->port = port;
c->connection_closed = connection_closed_handler;
c->priv = priv;
c->next = NULL;
-
+
if (type == CONNECTION_TCP)
{
if ((c->fd = socket(AF_INET, SOCK_STREAM, 0)) == -1)
LOG_ERROR("error creating socket: %s", strerror(errno));
exit(-1);
}
-
+
setsockopt(c->fd, SOL_SOCKET, SO_REUSEADDR, (void*)&so_reuseaddr_option, sizeof(int));
-
+
socket_nonblock(c->fd);
-
+
memset(&c->sin, 0, sizeof(c->sin));
c->sin.sin_family = AF_INET;
c->sin.sin_addr.s_addr = INADDR_ANY;
c->sin.sin_port = htons(port);
-
+
if (bind(c->fd, (struct sockaddr *)&c->sin, sizeof(c->sin)) == -1)
{
LOG_ERROR("couldn't bind to socket: %s", strerror(errno));
exit(-1);
}
-
+
#ifndef _WIN32
int segsize = 65536;
setsockopt(c->fd, IPPROTO_TCP, TCP_MAXSEG, &segsize, sizeof(int));
#endif
- int window_size = 128 * 1024;
-
+ int window_size = 128 * 1024;
+
/* These setsockopt()s must happen before the listen() */
-
+
setsockopt(c->fd, SOL_SOCKET, SO_SNDBUF,
(char *)&window_size, sizeof(window_size));
setsockopt(c->fd, SOL_SOCKET, SO_RCVBUF,
(char *)&window_size, sizeof(window_size));
-
+
if (listen(c->fd, 1) == -1)
{
LOG_ERROR("couldn't listen on socket: %s", strerror(errno));
{
/* use stdin */
c->fd = STDIN_FILENO;
-
+
#ifdef _WIN32
/* for win32 set stdin/stdout to binary mode */
if (_setmode(_fileno(stdout), _O_BINARY) < 0)
LOG_ERROR("unknown connection type: %d", type);
exit(1);
}
-
+
/* add to the end of linked list */
for (p = &services; *p; p = &(*p)->next);
*p = c;
-
+
return ERROR_OK;
}
{
service_t **p = &services;
service_t *c;
-
+
/* find service */
while ((c = *p))
- {
+ {
if (c->port == port)
- {
+ {
if (c->name)
free(c->name);
-
+
if (c->priv)
free(c->priv);
-
+
/* delete service */
*p = c->next;
free(c);
/* redirect p to next list pointer */
p = &(*p)->next;
}
-
+
return ERROR_OK;
}
}
services = NULL;
-
+
return ERROR_OK;
}
fd_set read_fds;
struct timeval tv;
int fd_max;
-
+
/* used in accept() */
int retval;
-
+
#ifndef _WIN32
if (signal(SIGPIPE, SIG_IGN) == SIG_ERR)
LOG_ERROR("couldn't set SIGPIPE to SIG_IGN");
/* do regular tasks after at most 10ms */
tv.tv_sec = 0;
tv.tv_usec = 10000;
-
+
while (!shutdown_openocd)
{
/* monitor sockets for acitvity */
if (service->fd > fd_max)
fd_max = service->fd;
}
-
+
if (service->connections)
{
connection_t *c;
-
+
for (c = service->connections; c; c = c->next)
{
/* check for activity on the connection */
}
}
}
-
+
#ifndef _WIN32
#if BUILD_ECOSBOARD == 0
if (server_use_pipes == 0)
openocd_sleep_prelude();
kept_alive();
-
+
/* Only while we're sleeping we'll let others run */
retval = socket_select(fd_max + 1, &read_fds, NULL, NULL, &tv);
openocd_sleep_postlude();
}
#endif
}
-
+
target_call_timer_callbacks();
process_jim_events ();
tv.tv_usec = 10000;
FD_ZERO(&read_fds); /* eCos leaves read_fds unchanged in this case! */
}
-
+
for (service = services; service; service = service->next)
{
/* handle new connections on listeners */
- if ((service->fd != -1)
- && (FD_ISSET(service->fd, &read_fds)))
+ if ((service->fd != -1)
+ && (FD_ISSET(service->fd, &read_fds)))
{
if (service->max_connections > 0)
{
LOG_INFO("rejected '%s' connection, no more connections allowed", service->name);
}
}
-
+
/* handle activity on connections */
if (service->connections)
{
connection_t *c;
-
+
for (c = service->connections; c;)
{
if ((FD_ISSET(c->fd, &read_fds)) || c->input_pending)
}
}
}
-
+
#ifndef _WIN32
#if BUILD_ECOSBOARD == 0
/* check for data on stdin if not using pipes */
}
#endif
}
-
+
return ERROR_OK;
}
signal(SIGBREAK, sig_handler);
signal(SIGABRT, sig_handler);
#endif
-
+
return ERROR_OK;
}
{
register_command(context, NULL, "shutdown", handle_shutdown_command,
COMMAND_ANY, "shut the server down");
-
+
return ERROR_OK;
}
if (memchr(result, '\n', reslen) == NULL)
tcl_output(connection, "\n", 1);
}
-
+
tclc->tc_lineoffset = 0;
tclc->tc_linedrop = 0;
}
tap_state_t paths[8];
}svf_statemove_t;
-svf_statemove_t svf_statemoves[] =
+svf_statemove_t svf_statemoves[] =
{
// from to num_of_moves, paths[8]
// {TAP_RESET, TAP_RESET, 1, {TAP_RESET}},
{TAP_RESET, TAP_IDLE, 2, {TAP_RESET, TAP_IDLE}},
{TAP_RESET, TAP_DRPAUSE, 6, {TAP_RESET, TAP_IDLE, TAP_DRSELECT, TAP_DRCAPTURE, TAP_DREXIT1, TAP_DRPAUSE}},
{TAP_RESET, TAP_IRPAUSE, 7, {TAP_RESET, TAP_IDLE, TAP_DRSELECT, TAP_IRSELECT, TAP_IRCAPTURE, TAP_IREXIT1, TAP_IRPAUSE}},
-
+
// {TAP_IDLE, TAP_RESET, 4, {TAP_IDLE, TAP_DRSELECT, TAP_IRSELECT, TAP_RESET}},
{TAP_IDLE, TAP_IDLE, 1, {TAP_IDLE}},
{TAP_IDLE, TAP_DRPAUSE, 5, {TAP_IDLE, TAP_DRSELECT, TAP_DRCAPTURE, TAP_DREXIT1, TAP_DRPAUSE}},
{TAP_IDLE, TAP_IRPAUSE, 6, {TAP_IDLE, TAP_DRSELECT, TAP_IRSELECT, TAP_IRCAPTURE, TAP_IREXIT1, TAP_IRPAUSE}},
-
+
// {TAP_DRPAUSE, TAP_RESET, 6, {TAP_DRPAUSE, TAP_DREXIT2, TAP_DRUPDATE, TAP_DRSELECT, TAP_IRSELECT, TAP_RESET}},
{TAP_DRPAUSE, TAP_IDLE, 4, {TAP_DRPAUSE, TAP_DREXIT2, TAP_DRUPDATE, TAP_IDLE}},
{TAP_DRPAUSE, TAP_DRPAUSE, 7, {TAP_DRPAUSE, TAP_DREXIT2, TAP_DRUPDATE, TAP_DRSELECT, TAP_DRCAPTURE, TAP_DREXIT1, TAP_DRPAUSE}},
{TAP_DRPAUSE, TAP_IRPAUSE, 8, {TAP_DRPAUSE, TAP_DREXIT2, TAP_DRUPDATE, TAP_DRSELECT, TAP_IRSELECT, TAP_IRCAPTURE, TAP_IREXIT1, TAP_IRPAUSE}},
-
+
// {TAP_IRPAUSE, TAP_RESET, 6, {TAP_IRPAUSE, TAP_IREXIT2, TAP_IRUPDATE, TAP_DRSELECT, TAP_IRSELECT, TAP_RESET}},
{TAP_IRPAUSE, TAP_IDLE, 4, {TAP_IRPAUSE, TAP_IREXIT2, TAP_IRUPDATE, TAP_IDLE}},
{TAP_IRPAUSE, TAP_DRPAUSE, 7, {TAP_IRPAUSE, TAP_IREXIT2, TAP_IRUPDATE, TAP_DRSELECT, TAP_DRCAPTURE, TAP_DREXIT1, TAP_DRPAUSE}},
for (index = 0; index < dimof(svf_statemoves); index++)
{
- if ((svf_statemoves[index].from == state_from)
+ if ((svf_statemoves[index].from == state_from)
&& (svf_statemoves[index].to == state_to))
{
if (TAP_RESET == state_from)
{
index = svf_check_tdo_para[i].buffer_offset;
len = svf_check_tdo_para[i].bit_len;
- if ((svf_check_tdo_para[i].enabled)
+ if ((svf_check_tdo_para[i].enabled)
&& buf_cmp_mask(&svf_tdi_buffer[index], &svf_tdo_buffer[index], &svf_mask_buffer[index], len))
{
unsigned bitmask;
memcpy(&received, svf_tdi_buffer + index, sizeof(unsigned));
memcpy(&expected, svf_tdo_buffer + index, sizeof(unsigned));
memcpy(&tapmask, svf_mask_buffer + index, sizeof(unsigned));
- LOG_ERROR("tdo check error at line %d",
+ LOG_ERROR("tdo check error at line %d",
svf_check_tdo_para[i].line_num);
- LOG_ERROR("read = 0x%X, want = 0x%X, mask = 0x%X",
- received & bitmask,
- expected & bitmask,
+ LOG_ERROR("read = 0x%X, want = 0x%X, mask = 0x%X",
+ received & bitmask,
+ expected & bitmask,
tapmask & bitmask);
return ERROR_FAIL;
}
field.in_value = NULL;
-
+
if (tap == NULL)
jtag_add_plain_ir_scan(1, &field, my_end_state);
/****************************************************************************
* Copyright (c) 2006 by Michael Fischer. All rights reserved.
*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions
+* 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
+*
+* 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
+* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
-* 3. Neither the name of the author nor the names of its contributors may
-* be used to endorse or promote products derived from this software
+* 3. Neither the name of the author nor the names of its contributors may
+* be used to endorse or promote products derived from this software
* without specific prior written permission.
*
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
-* THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 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
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+* THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 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.
*
****************************************************************************
/****************************************************************************
* Copyright (c) 2006 by Michael Fischer. All rights reserved.
*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions
+* 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
+*
+* 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
+* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
-* 3. Neither the name of the author nor the names of its contributors may
-* be used to endorse or promote products derived from this software
+* 3. Neither the name of the author nor the names of its contributors may
+* be used to endorse or promote products derived from this software
* without specific prior written permission.
*
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
-* THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 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
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+* THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 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.
*
****************************************************************************
* I use the include only, to show
* how to setup a include dir in the makefile
*/
-#include <stdio.h>
-#include <stdlib.h>
+#include <stdio.h>
+#include <stdlib.h>
#include "typedefs.h"
/*=========================================================================*/
DWORD a = 1;
DWORD b = 2;
DWORD c = 0;
-
+
a = a + d;
-
+
while (1)
{
a++;
b++;
c = a + b;
}
-
+
/*
* This return here make no sense.
* But to prevent the compiler warning:
* "return type of 'main' is not 'int'
* we use an int as return :-)
- */
+ */
return(0);
}
/****************************************************************************
* Copyright (c) 2006 by Michael Fischer. All rights reserved.
*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions
+* 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
+*
+* 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
+* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
-* 3. Neither the name of the author nor the names of its contributors may
-* be used to endorse or promote products derived from this software
+* 3. Neither the name of the author nor the names of its contributors may
+* be used to endorse or promote products derived from this software
* without specific prior written permission.
*
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
-* THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 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
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+* THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 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.
*
****************************************************************************
/****************************************************************************
* Copyright (c) 2006 by Michael Fischer. All rights reserved.
*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions
+* 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
+*
+* 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
+* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
-* 3. Neither the name of the author nor the names of its contributors may
-* be used to endorse or promote products derived from this software
+* 3. Neither the name of the author nor the names of its contributors may
+* be used to endorse or promote products derived from this software
* without specific prior written permission.
*
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
-* THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 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
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+* THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 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.
*
****************************************************************************
* I use the include only, to show
* how to setup a include dir in the makefile
*/
-#include <stdio.h>
-#include <stdlib.h>
+#include <stdio.h>
+#include <stdlib.h>
#include "typedefs.h"
/*=========================================================================*/
DWORD a = 1;
DWORD b = 2;
DWORD c = 0;
-
+
a = a + d;
-
+
while (1)
{
a++;
b++;
c = a + b;
}
-
+
/*
* This return here make no sense.
* But to prevent the compiler warning:
* "return type of 'main' is not 'int'
* we use an int as return :-)
- */
+ */
return(0);
}
/****************************************************************************
* Copyright (c) 2006 by Michael Fischer. All rights reserved.
*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions
+* 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
+*
+* 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
+* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
-* 3. Neither the name of the author nor the names of its contributors may
-* be used to endorse or promote products derived from this software
+* 3. Neither the name of the author nor the names of its contributors may
+* be used to endorse or promote products derived from this software
* without specific prior written permission.
*
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
-* THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 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
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+* THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 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.
*
****************************************************************************
/****************************************************************************
* Copyright (c) 2006 by Michael Fischer. All rights reserved.
*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions
+* 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
+*
+* 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
+* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
-* 3. Neither the name of the author nor the names of its contributors may
-* be used to endorse or promote products derived from this software
+* 3. Neither the name of the author nor the names of its contributors may
+* be used to endorse or promote products derived from this software
* without specific prior written permission.
*
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
-* THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 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
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+* THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 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.
*
****************************************************************************
* I use the include only, to show
* how to setup a include dir in the makefile
*/
-#include <stdio.h>
-#include <stdlib.h>
+#include <stdio.h>
+#include <stdlib.h>
#include "typedefs.h"
/*=========================================================================*/
DWORD a = 1;
DWORD b = 2;
DWORD c = 0;
-
+
a = a + d;
-
+
while (1)
{
a++;
b++;
c = a + b;
}
-
+
/*
* This return here make no sense.
* But to prevent the compiler warning:
* "return type of 'main' is not 'int'
* we use an int as return :-)
- */
+ */
return(0);
}
mPORTDSetPinsDigitalOut(BIT_1);
mPORTDClearBits(BIT_2);
mPORTDSetPinsDigitalOut(BIT_2);
-
+
while (1)
{
for (i = 0; i < 500000; i++)
/****************************************************************************
* Copyright (c) 2006 by Michael Fischer. All rights reserved.
*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions
+* 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
+*
+* 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
+* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
-* 3. Neither the name of the author nor the names of its contributors may
-* be used to endorse or promote products derived from this software
+* 3. Neither the name of the author nor the names of its contributors may
+* be used to endorse or promote products derived from this software
* without specific prior written permission.
*
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
-* THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 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
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+* THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 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.
*
****************************************************************************
/****************************************************************************
* Copyright (c) 2006 by Michael Fischer. All rights reserved.
*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions
+* 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
+*
+* 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
+* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
-* 3. Neither the name of the author nor the names of its contributors may
-* be used to endorse or promote products derived from this software
+* 3. Neither the name of the author nor the names of its contributors may
+* be used to endorse or promote products derived from this software
* without specific prior written permission.
*
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
-* THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 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
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+* THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 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.
*
****************************************************************************
DWORD a = 1;
DWORD b = 2;
DWORD c = 0;
-
+
a = a + d;
-
+
while (1)
{
a++;
b++;
c = a + b;
}
-
+
/*
* This return here make no sense.
* But to prevent the compiler warning:
* "return type of 'main' is not 'int'
* we use an int as return :-)
- */
+ */
return(0);
}
/****************************************************************************
* Copyright (c) 2006 by Michael Fischer. All rights reserved.
*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions
+* 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
+*
+* 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
+* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
-* 3. Neither the name of the author nor the names of its contributors may
-* be used to endorse or promote products derived from this software
+* 3. Neither the name of the author nor the names of its contributors may
+* be used to endorse or promote products derived from this software
* without specific prior written permission.
*
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
-* THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 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
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+* THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 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.
*
****************************************************************************
/****************************************************************************
* Copyright (c) 2006 by Michael Fischer. All rights reserved.
*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions
+* 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
+*
+* 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
+* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
-* 3. Neither the name of the author nor the names of its contributors may
-* be used to endorse or promote products derived from this software
+* 3. Neither the name of the author nor the names of its contributors may
+* be used to endorse or promote products derived from this software
* without specific prior written permission.
*
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
-* THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 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
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+* THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 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.
*
****************************************************************************
DWORD a = 1;
DWORD b = 2;
DWORD c = 0;
-
+
a = a + d;
-
+
while (1)
{
a++;
b++;
c = a + b;
}
-
+
/*
* This return here make no sense.
* But to prevent the compiler warning:
* "return type of 'main' is not 'int'
* we use an int as return :-)
- */
+ */
return(0);
}
/****************************************************************************
* Copyright (c) 2006 by Michael Fischer. All rights reserved.
*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions
+* 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
+*
+* 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
+* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
-* 3. Neither the name of the author nor the names of its contributors may
-* be used to endorse or promote products derived from this software
+* 3. Neither the name of the author nor the names of its contributors may
+* be used to endorse or promote products derived from this software
* without specific prior written permission.
*
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
-* THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 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
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+* THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 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.
*
****************************************************************************
/****************************************************************************
* Copyright (c) 2006 by Michael Fischer. All rights reserved.
*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions
+* 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
+*
+* 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
+* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
-* 3. Neither the name of the author nor the names of its contributors may
-* be used to endorse or promote products derived from this software
+* 3. Neither the name of the author nor the names of its contributors may
+* be used to endorse or promote products derived from this software
* without specific prior written permission.
*
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
-* THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 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
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+* THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 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.
*
****************************************************************************
DWORD a = 1;
DWORD b = 2;
DWORD c = 0;
-
+
while (1)
{
a++;
b++;
c = a + b;
}
-
+
/*
* This return here make no sense.
* But to prevent the compiler warning:
* "return type of 'main' is not 'int'
* we use an int as return :-)
- */
+ */
return(0);
}
/****************************************************************************
* Copyright (c) 2006 by Michael Fischer. All rights reserved.
*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions
+* 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
+*
+* 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
+* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
-* 3. Neither the name of the author nor the names of its contributors may
-* be used to endorse or promote products derived from this software
+* 3. Neither the name of the author nor the names of its contributors may
+* be used to endorse or promote products derived from this software
* without specific prior written permission.
*
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
-* THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 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
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+* THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 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.
*
****************************************************************************
/****************************************************************************
* Copyright (c) 2006 by Michael Fischer. All rights reserved.
*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions
+* 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
+*
+* 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
+* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
-* 3. Neither the name of the author nor the names of its contributors may
-* be used to endorse or promote products derived from this software
+* 3. Neither the name of the author nor the names of its contributors may
+* be used to endorse or promote products derived from this software
* without specific prior written permission.
*
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
-* THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 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
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+* THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 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.
*
****************************************************************************
DWORD a = 1;
DWORD b = 2;
DWORD c = 0;
-
+
a = a + d;
-
+
while (1)
{
a++;
b++;
c = a + b;
}
-
+
/*
* This return here make no sense.
* But to prevent the compiler warning:
* "return type of 'main' is not 'int'
* we use an int as return :-)
- */
+ */
return(0);
}
/****************************************************************************
* Copyright (c) 2006 by Michael Fischer. All rights reserved.
*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions
+* 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
+*
+* 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
+* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
-* 3. Neither the name of the author nor the names of its contributors may
-* be used to endorse or promote products derived from this software
+* 3. Neither the name of the author nor the names of its contributors may
+* be used to endorse or promote products derived from this software
* without specific prior written permission.
*
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
-* THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 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
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+* THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 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.
*
****************************************************************************
/****************************************************************************
* Copyright (c) 2006 by Michael Fischer. All rights reserved.
*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions
+* 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
+*
+* 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
+* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
-* 3. Neither the name of the author nor the names of its contributors may
-* be used to endorse or promote products derived from this software
+* 3. Neither the name of the author nor the names of its contributors may
+* be used to endorse or promote products derived from this software
* without specific prior written permission.
*
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
-* THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 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
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+* THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 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.
*
****************************************************************************
DWORD a = 1;
DWORD b = 2;
DWORD c = 0;
-
+
a = a + d;
-
+
while (1)
{
a++;
b++;
c = a + b;
}
-
+
/*
* This return here make no sense.
* But to prevent the compiler warning:
* "return type of 'main' is not 'int'
* we use an int as return :-)
- */
+ */
return(0);
}
-/* simple app.
+/* simple app.
modify test.ld to change address.
}
/* MAIN ARM FUNTION */
-int main (void)
+int main (void)
{
- int i;
+ int i;
volatile unsigned char *ledoff = ((volatile unsigned char *)0xD4000008);
volatile unsigned char *ledon = ((volatile unsigned char *)0xD400000C);
-
+
for (i = 0; i < 10000; i++)
{
*ledon = 0x30;
}
/* MAIN ARM FUNTION */
-int main (void)
+int main (void)
{
volatile unsigned char *led = ((volatile unsigned char *)0xB6020000);
-
+
while (1)
{
*led = 0xFF;