aboutsummaryrefslogtreecommitdiff
path: root/jim-eventloop.h
diff options
context:
space:
mode:
Diffstat (limited to 'jim-eventloop.h')
-rw-r--r--jim-eventloop.h47
1 files changed, 30 insertions, 17 deletions
diff --git a/jim-eventloop.h b/jim-eventloop.h
index ddb6fc9..e09170e 100644
--- a/jim-eventloop.h
+++ b/jim-eventloop.h
@@ -2,25 +2,25 @@
*
* Copyright 2005 Salvatore Sanfilippo <antirez@invece.org>
* Copyright 2005 Clemens Hintze <c.hintze@gmx.net>
- * Copyright 2005 patthoyts - Pat Thoyts <patthoyts@users.sf.net>
- * Copyright 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
@@ -33,7 +33,7 @@
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation
* are those of the authors and should not be interpreted as representing
* official policies, either expressed or implied, of the Jim Tcl Project.
@@ -63,16 +63,18 @@ typedef void Jim_EventFinalizerProc(Jim_Interp *interp, void *clientData);
#define JIM_EVENT_EXCEPTION 4
#define JIM_EVENT_FEOF 8
-#define JIM_API(x) x
-#define JIM_STATIC
-
-JIM_STATIC int Jim_EventLoopOnLoad(Jim_Interp *interp);
-
-/* --- 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
+#ifndef __JIM_EVENTLOOP_CORE__
+# if defined JIM_EXTENSION || defined JIM_EMBEDDED
+# define JIM_API(x) (*x)
+# define JIM_STATIC
+# else
+# define JIM_API(x) (*x)
+# define JIM_STATIC extern
+# endif
+#else
+# define JIM_API(x) x
+# define JIM_STATIC static
+#endif /* __JIM_EVENTLOOP_CORE__ */
JIM_STATIC void JIM_API(Jim_CreateFileHandler) (Jim_Interp *interp,
void *handle, int mask,
@@ -95,6 +97,17 @@ JIM_STATIC int JIM_API(Jim_ProcessEvents) (Jim_Interp *interp, int flags);
#define JIM_GET_API(name) \
Jim_GetApi(interp, "Jim_" #name, ((void *)&Jim_ ## name))
+#if defined(JIM_EXTENSION) || defined(JIM_EMBEDDED)
+/* This must be included "inline" inside the extension */
+static void Jim_ImportEventloopAPI(Jim_Interp *interp)
+{
+ JIM_GET_API(CreateFileHandler);
+ JIM_GET_API(DeleteFileHandler);
+ JIM_GET_API(CreateTimeHandler);
+ JIM_GET_API(DeleteTimeHandler);
+ JIM_GET_API(ProcessEvents);
+}
+#endif /* defined JIM_EXTENSION || defined JIM_EMBEDDED */
#undef JIM_GET_API
#endif /* __JIM_EVENTLOOP_CORE__ */