Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
card10
openocd
Commits
559d08c1
Commit
559d08c1
authored
Oct 10, 2010
by
Øyvind Harboe
Browse files
jim tests: use installed
Delete obsolete jim that comes with OpenOCD.
parent
4617cd0f
Changes
14
Expand all
Show whitespace changes
Inline
Side-by-side
src/Makefile.am
View file @
559d08c1
...
...
@@ -18,7 +18,7 @@ MAINFILE = main.c
endif
openocd_SOURCES
=
$(MAINFILE)
openocd_LDADD
=
libopenocd.la
openocd_LDADD
=
libopenocd.la
-ljim
libopenocd_la_SOURCES
=
\
hello.c
\
...
...
src/ecosboard.c
View file @
559d08c1
...
...
@@ -500,6 +500,10 @@ static void zylinjtag_startNetwork(void)
cyg_httpd_init_tcl_interpreter
();
// Kludge! Why can't I do this from httpd.c??? I get linker errors...
// some of that --start/end-group stuff?
Jim_InitStaticExtensions
(
httpstate
.
jim_interp
);
Jim_CreateCommand
(
httpstate
.
jim_interp
,
"log"
,
zylinjtag_Jim_Command_log
,
NULL
,
NULL
);
Jim_CreateCommand
(
httpstate
.
jim_interp
,
"zy1000_reboot"
,
...
...
src/helper/Makefile.am
View file @
559d08c1
...
...
@@ -9,7 +9,7 @@ noinst_LTLIBRARIES = libhelper.la
if
ECOSBOARD
CONFIGFILES
=
time_support_ecos.c
else
CONFIGFILES
=
options.c
jim.c jim-eventloop.c
time_support_common.c
CONFIGFILES
=
options.c time_support_common.c
endif
...
...
@@ -48,8 +48,6 @@ noinst_HEADERS = \
time_support.h
\
replacements.h
\
fileio.h
\
jim.h
\
jim-eventloop.h
\
system.h
\
bin2char.c
...
...
src/helper/command.c
View file @
559d08c1
...
...
@@ -684,7 +684,8 @@ int command_run_line(struct command_context *context, char *line)
if
(
retval
!=
ERROR_COMMAND_CLOSE_CONNECTION
)
{
/* We do not print the connection closed error message */
Jim_PrintErrorMessage
(
interp
);
Jim_MakeErrorMessage
(
interp
);
LOG_USER_N
(
"%s
\n
"
,
Jim_GetString
(
Jim_GetResult
(
interp
),
NULL
));
}
if
(
retval
==
ERROR_OK
)
{
...
...
@@ -785,89 +786,6 @@ static int jim_echo(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
return
JIM_OK
;
}
static
size_t
openocd_jim_fwrite
(
const
void
*
_ptr
,
size_t
size
,
size_t
n
,
void
*
cookie
)
{
size_t
nbytes
;
const
char
*
ptr
;
Jim_Interp
*
interp
;
/* make it a char easier to read code */
ptr
=
_ptr
;
interp
=
cookie
;
nbytes
=
size
*
n
;
if
(
ptr
==
NULL
||
interp
==
NULL
||
nbytes
==
0
)
{
return
0
;
}
/* do we have to chunk it? */
if
(
ptr
[
nbytes
]
==
0
)
{
/* no it is a C style string */
LOG_USER_N
(
"%s"
,
ptr
);
return
strlen
(
ptr
);
}
/* GRR we must chunk - not null terminated */
while
(
nbytes
)
{
char
chunk
[
128
+
1
];
int
x
;
x
=
nbytes
;
if
(
x
>
128
)
{
x
=
128
;
}
/* copy it */
memcpy
(
chunk
,
ptr
,
x
);
/* terminate it */
chunk
[
n
]
=
0
;
/* output it */
LOG_USER_N
(
"%s"
,
chunk
);
ptr
+=
x
;
nbytes
-=
x
;
}
return
n
;
}
static
size_t
openocd_jim_fread
(
void
*
ptr
,
size_t
size
,
size_t
n
,
void
*
cookie
)
{
/* TCL wants to read... tell him no */
return
0
;
}
static
int
openocd_jim_vfprintf
(
void
*
cookie
,
const
char
*
fmt
,
va_list
ap
)
{
char
*
cp
;
int
n
;
Jim_Interp
*
interp
;
n
=
-
1
;
interp
=
cookie
;
if
(
interp
==
NULL
)
return
n
;
cp
=
alloc_vprintf
(
fmt
,
ap
);
if
(
cp
)
{
LOG_USER_N
(
"%s"
,
cp
);
n
=
strlen
(
cp
);
free
(
cp
);
}
return
n
;
}
static
int
openocd_jim_fflush
(
void
*
cookie
)
{
/* nothing to flush */
return
0
;
}
static
char
*
openocd_jim_fgets
(
char
*
s
,
int
size
,
void
*
cookie
)
{
/* not supported */
errno
=
ENOTSUP
;
return
NULL
;
}
/* Capture progress output and return as tcl return value. If the
* progress output was empty, return tcl return value.
*/
...
...
@@ -1400,11 +1318,11 @@ struct command_context* command_init(const char *startup_tcl, Jim_Interp *interp
/* Create a jim interpreter if we were not handed one */
if
(
interp
==
NULL
)
{
Jim_InitEmbedded
();
/* Create an interpreter */
interp
=
Jim_CreateInterp
();
/* Add all the Jim core commands */
Jim_RegisterCoreCommands
(
interp
);
Jim_InitStaticExtensions
(
interp
);
}
#endif
context
->
interp
=
interp
;
...
...
@@ -1442,26 +1360,14 @@ struct command_context* command_init(const char *startup_tcl, Jim_Interp *interp
Jim_CreateCommand
(
interp
,
"echo"
,
jim_echo
,
NULL
,
NULL
);
Jim_CreateCommand
(
interp
,
"capture"
,
jim_capture
,
NULL
,
NULL
);
/* Set Jim's STDIO */
interp
->
cookie_stdin
=
interp
;
interp
->
cookie_stdout
=
interp
;
interp
->
cookie_stderr
=
interp
;
interp
->
cb_fwrite
=
openocd_jim_fwrite
;
interp
->
cb_fread
=
openocd_jim_fread
;
interp
->
cb_vfprintf
=
openocd_jim_vfprintf
;
interp
->
cb_fflush
=
openocd_jim_fflush
;
interp
->
cb_fgets
=
openocd_jim_fgets
;
register_commands
(
context
,
NULL
,
command_builtin_handlers
);
#if !BUILD_ECOSBOARD
Jim_EventLoopOnLoad
(
interp
);
#endif
Jim_SetAssocData
(
interp
,
"context"
,
NULL
,
context
);
if
(
Jim_Eval_Named
(
interp
,
startup_tcl
,
"embedded:startup.tcl"
,
1
)
==
JIM_ERR
)
{
LOG_ERROR
(
"Failed to run startup.tcl (embedded into OpenOCD)"
);
Jim_PrintErrorMessage
(
interp
);
Jim_MakeErrorMessage
(
interp
);
LOG_USER_N
(
"%s"
,
Jim_GetString
(
Jim_GetResult
(
interp
),
NULL
));
exit
(
-
1
);
}
Jim_DeleteAssocData
(
interp
,
"context"
);
...
...
src/helper/command.h
View file @
559d08c1
...
...
@@ -29,12 +29,11 @@
#if BUILD_ECOSBOARD
#include <stdio.h>
#include <stdarg.h>
/* Jim is provied by eCos */
#include <cyg/jimtcl/jim.h>
#else
#include <helper/jim.h>
#endif
#include <jim.h>
#include <jim-nvp.h>
/* To achieve C99 printf compatibility in MinGW, gnu_printf should be
* used for __attribute__((format( ... ))), with GCC v4.4 or later
*/
...
...
src/helper/jim-eventloop.c
deleted
100644 → 0
View file @
4617cd0f
/* Jim - A small embeddable Tcl interpreter
*
* 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 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
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* JIM TCL PROJECT 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.
*
* 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.
**/
/* TODO:
*
* - to really use flags in Jim_ProcessEvents()
* - more complete [after] command with [after info] and other subcommands.
* - Win32 port
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#define JIM_EXTENSION
#define __JIM_EVENTLOOP_CORE__
#ifdef __ECOS
#include <pkgconf/jimtcl.h>
#include <sys/time.h>
#include <cyg/jimtcl/jim.h>
#include <cyg/jimtcl/jim-eventloop.h>
#else
#include "jim.h"
#include "jim-eventloop.h"
#endif
/* File event structure */
typedef
struct
Jim_FileEvent
{
void
*
handle
;
int
mask
;
/* one of JIM_EVENT_(READABLE | WRITABLE | EXCEPTION) */
Jim_FileProc
*
fileProc
;
Jim_EventFinalizerProc
*
finalizerProc
;
void
*
clientData
;
struct
Jim_FileEvent
*
next
;
}
Jim_FileEvent
;
/* Time event structure */
typedef
struct
Jim_TimeEvent
{
jim_wide
id
;
/* time event identifier. */
int
mode
;
/* restart, repetitive .. UK */
long
initialms
;
/* initial relativ timer value UK */
long
when_sec
;
/* seconds */
long
when_ms
;
/* milliseconds */
Jim_TimeProc
*
timeProc
;
Jim_EventFinalizerProc
*
finalizerProc
;
void
*
clientData
;
struct
Jim_TimeEvent
*
next
;
}
Jim_TimeEvent
;
/* Per-interp stucture containing the state of the event loop */
typedef
struct
Jim_EventLoop
{
jim_wide
timeEventNextId
;
Jim_FileEvent
*
fileEventHead
;
Jim_TimeEvent
*
timeEventHead
;
}
Jim_EventLoop
;
static
void
Jim_CreateFileHandler
(
Jim_Interp
*
interp
,
void
*
handle
,
int
mask
,
Jim_FileProc
*
proc
,
void
*
clientData
,
Jim_EventFinalizerProc
*
finalizerProc
)
{
Jim_FileEvent
*
fe
;
Jim_EventLoop
*
eventLoop
=
Jim_GetAssocData
(
interp
,
"eventloop"
);
// fprintf(stderr,"rein\n");
fe
=
Jim_Alloc
(
sizeof
(
*
fe
));
fe
->
handle
=
handle
;
fe
->
mask
=
mask
;
fe
->
fileProc
=
proc
;
fe
->
finalizerProc
=
finalizerProc
;
fe
->
clientData
=
clientData
;
fe
->
next
=
eventLoop
->
fileEventHead
;
eventLoop
->
fileEventHead
=
fe
;
// fprintf(stderr,"raus\n");
}
static
void
Jim_DeleteFileHandler
(
Jim_Interp
*
interp
,
void
*
handle
)
{
Jim_FileEvent
*
fe
,
*
prev
=
NULL
;
Jim_EventLoop
*
eventLoop
=
Jim_GetAssocData
(
interp
,
"eventloop"
);
fe
=
eventLoop
->
fileEventHead
;
while
(
fe
)
{
if
(
fe
->
handle
==
handle
)
{
if
(
prev
==
NULL
)
eventLoop
->
fileEventHead
=
fe
->
next
;
else
prev
->
next
=
fe
->
next
;
if
(
fe
->
finalizerProc
)
fe
->
finalizerProc
(
interp
,
fe
->
clientData
);
Jim_Free
(
fe
);
return
;
}
prev
=
fe
;
fe
=
fe
->
next
;
}
}
/* That's another part of this extension that needs to be ported
* to WIN32. */
static
void
JimGetTime
(
long
*
seconds
,
long
*
milliseconds
)
{
struct
timeval
tv
;
gettimeofday
(
&
tv
,
NULL
);
*
seconds
=
tv
.
tv_sec
;
*
milliseconds
=
tv
.
tv_usec
/
1000
;
}
static
jim_wide
Jim_CreateTimeHandler
(
Jim_Interp
*
interp
,
jim_wide
milliseconds
,
Jim_TimeProc
*
proc
,
void
*
clientData
,
Jim_EventFinalizerProc
*
finalizerProc
)
{
Jim_EventLoop
*
eventLoop
=
Jim_GetAssocData
(
interp
,
"eventloop"
);
jim_wide
id
=
eventLoop
->
timeEventNextId
++
;
Jim_TimeEvent
*
te
;
long
cur_sec
,
cur_ms
;
JimGetTime
(
&
cur_sec
,
&
cur_ms
);
te
=
Jim_Alloc
(
sizeof
(
*
te
));
te
->
id
=
id
;
te
->
mode
=
0
;
te
->
initialms
=
milliseconds
;
te
->
when_sec
=
cur_sec
+
milliseconds
/
1000
;
te
->
when_ms
=
cur_ms
+
milliseconds
%
1000
;
if
(
te
->
when_ms
>=
1000
)
{
te
->
when_sec
++
;
te
->
when_ms
-=
1000
;
}
te
->
timeProc
=
proc
;
te
->
finalizerProc
=
finalizerProc
;
te
->
clientData
=
clientData
;
te
->
next
=
eventLoop
->
timeEventHead
;
eventLoop
->
timeEventHead
=
te
;
return
id
;
}
static
jim_wide
Jim_DeleteTimeHandler
(
Jim_Interp
*
interp
,
jim_wide
id
)
{
Jim_TimeEvent
*
te
,
*
prev
=
NULL
;
Jim_EventLoop
*
eventLoop
=
Jim_GetAssocData
(
interp
,
"eventloop"
);
long
cur_sec
,
cur_ms
;
jim_wide
remain
;
JimGetTime
(
&
cur_sec
,
&
cur_ms
);
te
=
eventLoop
->
timeEventHead
;
if
(
id
>=
eventLoop
->
timeEventNextId
)
return
-
2
;
/* wrong event ID */
while
(
te
)
{
if
(
te
->
id
==
id
)
{
remain
=
(
te
->
when_sec
-
cur_sec
)
*
1000
;
remain
+=
(
te
->
when_ms
-
cur_ms
)
;
remain
=
(
remain
<
0
)
?
0
:
remain
;
if
(
prev
==
NULL
)
eventLoop
->
timeEventHead
=
te
->
next
;
else
prev
->
next
=
te
->
next
;
if
(
te
->
finalizerProc
)
te
->
finalizerProc
(
interp
,
te
->
clientData
);
Jim_Free
(
te
);
return
remain
;
}
prev
=
te
;
te
=
te
->
next
;
}
return
-
1
;
/* NO event with the specified ID found */
}
/* Search the first timer to fire.
* This operation is useful to know how many time the select can be
* put in sleep without to delay any event.
* If there are no timers NULL is returned. */
static
Jim_TimeEvent
*
JimSearchNearestTimer
(
Jim_EventLoop
*
eventLoop
)
{
Jim_TimeEvent
*
te
=
eventLoop
->
timeEventHead
;
Jim_TimeEvent
*
nearest
=
NULL
;
while
(
te
)
{
if
(
!
nearest
||
te
->
when_sec
<
nearest
->
when_sec
||
(
te
->
when_sec
==
nearest
->
when_sec
&&
te
->
when_ms
<
nearest
->
when_ms
))
nearest
=
te
;
te
=
te
->
next
;
}
return
nearest
;
}
/* --- 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_DONT_WAIT 4
/* Process every pending time event, then every pending file event
* (that may be registered by time event callbacks just processed).
* Without special flags the function sleeps until some file event
* fires, or when the next time event occurrs (if any).
*
* If flags is 0, the function does nothing and returns.
* if flags has JIM_ALL_EVENTS set, all the kind of events are processed.
* if flags has JIM_FILE_EVENTS set, file events are processed.
* if flags has JIM_TIME_EVENTS set, time events are processed.
* if flags has JIM_DONT_WAIT set the function returns ASAP until all
* the events that's possible to process without to wait are processed.
*
* The function returns the number of events processed. */
int
Jim_ProcessEvents
(
Jim_Interp
*
interp
,
int
flags
)
{
int
maxfd
=
0
,
numfd
=
0
,
processed
=
0
;
fd_set
rfds
,
wfds
,
efds
;
Jim_EventLoop
*
eventLoop
=
Jim_GetAssocData
(
interp
,
"eventloop"
);
Jim_FileEvent
*
fe
=
eventLoop
->
fileEventHead
;
Jim_TimeEvent
*
te
;
jim_wide
maxId
;
JIM_NOTUSED
(
flags
);
FD_ZERO
(
&
rfds
);
FD_ZERO
(
&
wfds
);
FD_ZERO
(
&
efds
);
/* Check file events */
while
(
fe
!=
NULL
)
{
int
fd
=
fileno
((
FILE
*
)
fe
->
handle
);
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
);
if
(
maxfd
<
fd
)
maxfd
=
fd
;
numfd
++
;
fe
=
fe
->
next
;
}
/* Note that we want call select() even if there are no
* file events to process as long as we want to process time
* events, in order to sleep until the next time event is ready
* to fire. */
if
(
numfd
||
((
flags
&
JIM_TIME_EVENTS
)
&&
!
(
flags
&
JIM_DONT_WAIT
)))
{
int
retval
;
Jim_TimeEvent
*
shortest
;
struct
timeval
tv
,
*
tvp
;
jim_wide
dt
;
shortest
=
JimSearchNearestTimer
(
eventLoop
);
if
(
shortest
)
{
long
now_sec
,
now_ms
;
/* Calculate the time missing for the nearest
* timer to fire. */
JimGetTime
(
&
now_sec
,
&
now_ms
);
tvp
=
&
tv
;
dt
=
1000
*
(
shortest
->
when_sec
-
now_sec
);
dt
+=
(
shortest
->
when_ms
-
now_ms
);
if
(
dt
<
0
)
{
dt
=
1
;
}
tvp
->
tv_sec
=
dt
/
1000
;
tvp
->
tv_usec
=
dt
%
1000
;
// fprintf(stderr,"Next %d.% 8d\n",(int)tvp->tv_sec,(int)tvp->tv_usec);
}
else
{
tvp
=
NULL
;
/* wait forever */
// fprintf(stderr,"No Event\n");
}
retval
=
select
(
maxfd
+
1
,
&
rfds
,
&
wfds
,
&
efds
,
tvp
);
if
(
retval
<
0
)
{
switch
(
errno
)
{
case
EINTR
:
fprintf
(
stderr
,
"select EINTR
\n
"
);
break
;
case
EINVAL
:
fprintf
(
stderr
,
"select EINVAL
\n
"
);
break
;
case
ENOMEM
:
fprintf
(
stderr
,
"select ENOMEM
\n
"
);
break
;
}
}
else
if
(
retval
>
0
)
{
fe
=
eventLoop
->
fileEventHead
;
while
(
fe
!=
NULL
)
{
int
fd
=
fileno
((
FILE
*
)
fe
->
handle
);
// fprintf(stderr,"fd: %d mask: %02x \n",fd,fe->mask);
if
((
fe
->
mask
&
JIM_EVENT_READABLE
&&
FD_ISSET
(
fd
,
&
rfds
))
||
(
fe
->
mask
&
JIM_EVENT_WRITABLE
&&
FD_ISSET
(
fd
,
&
wfds
))
||
(
fe
->
mask
&
JIM_EVENT_EXCEPTION
&&
FD_ISSET
(
fd
,
&
efds
)))
{
int
mask
=
0
;
if
(
fe
->
mask
&
JIM_EVENT_READABLE
&&
FD_ISSET
(
fd
,
&
rfds
))
{
mask
|=
JIM_EVENT_READABLE
;
if
((
fe
->
mask
&
JIM_EVENT_FEOF
)
&&
feof
((
FILE
*
)
fe
->
handle
))
mask
|=
JIM_EVENT_FEOF
;
}
if
(
fe
->
mask
&
JIM_EVENT_WRITABLE
&&
FD_ISSET
(
fd
,
&
wfds
))
mask
|=
JIM_EVENT_WRITABLE
;
if
(
fe
->
mask
&
JIM_EVENT_EXCEPTION
&&
FD_ISSET
(
fd
,
&
efds
))
mask
|=
JIM_EVENT_EXCEPTION
;
if
(
fe
->
fileProc
(
interp
,
fe
->
clientData
,
mask
)
==
JIM_ERR
)
{
/* Remove the element on handler error */
Jim_DeleteFileHandler
(
interp
,
fe
->
handle
);
}
processed
++
;
/* After an event is processed our file event list
* may no longer be the same, so what we do
* is to clear the bit for this file descriptor and
* restart again from the head. */
fe
=
eventLoop
->
fileEventHead
;
FD_CLR
(
fd
,
&
rfds
);
FD_CLR
(
fd
,
&
wfds
);
FD_CLR
(
fd
,
&
efds
);
}
else
{
fe
=
fe
->
next
;
}
}
}
}
/* Check time events */
te
=
eventLoop
->
timeEventHead
;
maxId
=
eventLoop
->
timeEventNextId
-
1
;
while
(
te
)
{
long
now_sec
,
now_ms
;
jim_wide
id
;
if
(
te
->
id
>
maxId
)
{
te
=
te
->
next
;
continue
;
}
JimGetTime
(
&
now_sec
,
&
now_ms
);
if
(
now_sec
>
te
->
when_sec
||
(
now_sec
==
te
->
when_sec
&&
now_ms
>=
te
->
when_ms
))
{
id
=
te
->
id
;
te
->
timeProc
(
interp
,
te
->
clientData
);
/* After an event is processed our time event list may
* no longer be the same, so we restart from head.
* Still we make sure to don't process events registered
* by event handlers itself in order to don't loop forever
* even in case an [after 0] that continuously register
* itself. To do so we saved the max ID we want to handle. */
Jim_DeleteTimeHandler
(
interp
,
id
);
te
=
eventLoop
->
timeEventHead
;
}
else
{
te
=
te
->
next
;
}
}
return
processed
;
}
/* ---------------------------------------------------------------------- */
static
void
JimELAssocDataDeleProc
(
Jim_Interp
*
interp
,
void
*
data
)
{
void
*
next
;
Jim_FileEvent
*
fe
;
Jim_TimeEvent
*
te
;
Jim_EventLoop
*
eventLoop
=
data
;
fe
=
eventLoop
->
fileEventHead
;
while
(
fe
)
{
next
=
fe
->
next
;
if
(
fe
->
finalizerProc
)
fe
->
finalizerProc
(
interp
,
fe
->
clientData
);
Jim_Free
(
fe
);
fe
=
next
;
}
te
=
eventLoop
->
timeEventHead
;
while
(
te
)
{
next
=
te
->
next
;
if
(
te
->
finalizerProc
)
te
->
finalizerProc
(
interp
,
te
->
clientData
);
Jim_Free
(
te
);
te
=
next
;
}
Jim_Free
(
data
);
}
static
int
JimELVwaitCommand
(
Jim_Interp
*
interp
,
int
argc
,
Jim_Obj
*
const
*
argv
)
{
Jim_Obj
*
oldValue
;
if
(
argc
!=
2
)
{
Jim_WrongNumArgs
(
interp
,
1
,
argv
,
"name"
);
return
JIM_ERR
;
}
oldValue
=
Jim_GetGlobalVariable
(
interp
,
argv
[
1
],
JIM_NONE
);