*
* 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 2008 oharboe - Øyvind Harboe - oyvind.harboe@zylin.com
+ * 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_EVENTLOOP_CORE__
#ifdef __ECOS
#include <pkgconf/jimtcl.h>
-#endif
-#ifdef __ECOS
+#include <sys/time.h>
#include <cyg/jimtcl/jim.h>
#include <cyg/jimtcl/jim-eventloop.h>
#else
/* File event structure */
typedef struct Jim_FileEvent {
void *handle;
- int mask; /* one of JIM_EVENT_(READABLE|WRITABLE|EXCEPTION) */
+ int mask; /* one of JIM_EVENT_(READABLE | WRITABLE | EXCEPTION) */
Jim_FileProc *fileProc;
Jim_EventFinalizerProc *finalizerProc;
void *clientData;
}
// 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) {
/* --- POSIX version of Jim_ProcessEvents, for now the only available --- */
#define JIM_FILE_EVENTS 1
#define JIM_TIME_EVENTS 2
-#define JIM_ALL_EVENTS (JIM_FILE_EVENTS|JIM_TIME_EVENTS)
+#define JIM_ALL_EVENTS (JIM_FILE_EVENTS | JIM_TIME_EVENTS)
#define JIM_DONT_WAIT 4
/* Process every pending time event, then every pending file event
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);
JimGetTime(&now_sec, &now_ms);
tvp = &tv;
dt = 1000 * (shortest->when_sec - now_sec);
- dt += ( shortest->when_ms - now_ms);
+ dt += (shortest->when_ms - now_ms);
if (dt < 0) {
dt = 1;
}
// fprintf(stderr,"No Event\n");
}
- retval = select(maxfd+1, &rfds, &wfds, &efds, tvp);
+ retval = select(maxfd + 1, &rfds, &wfds, &efds, tvp);
if (retval < 0) {
switch (errno) {
case EINTR: fprintf(stderr,"select EINTR\n"); break;
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;
int tlen ;
jim_wide remain = 0;
const char *tok = Jim_GetString(argv[2], &tlen);
- if ( sscanf(tok,"after#%lld",&id) == 1) {
+ if (sscanf(tok,"after#%" JIM_WIDE_MODIFIER, &id) == 1) {
remain = Jim_DeleteTimeHandler(interp, id);
if (remain > -2) {
Jim_SetResult(interp, Jim_NewIntObj(interp, remain));
}
default:
fprintf(stderr,"unserviced option to after %d\n",option);
- }
+ }
return JIM_OK;
}