+#define inline_size static inline
+
+#if EV_MINIMAL
+# define inline_speed static noinline
+#else
+# define inline_speed static inline
+#endif
+
+#define NUMPRI (EV_MAXPRI - EV_MINPRI + 1)
+#define ABSPRI(w) (((W)w)->priority - EV_MINPRI)
+
+#define EMPTY /* required for microsofts broken pseudo-c compiler */
+#define EMPTY2(a,b) /* used to suppress some warnings */
+
+typedef ev_watcher *W;
+typedef ev_watcher_list *WL;
+typedef ev_watcher_time *WT;
+
+#if EV_USE_MONOTONIC
+/* sig_atomic_t is used to avoid per-thread variables or locking but still */
+/* giving it a reasonably high chance of working on typical architetcures */
+static sig_atomic_t have_monotonic; /* did clock_gettime (CLOCK_MONOTONIC) work? */
+#endif
+
+#ifdef _WIN32
+# include "ev_win32.c"
+#endif
+
+/*****************************************************************************/
+
+static void (*syserr_cb)(const char *msg);
+
+void
+ev_set_syserr_cb (void (*cb)(const char *msg))
+{
+ syserr_cb = cb;
+}
+
+static void noinline
+syserr (const char *msg)
+{
+ if (!msg)
+ msg = "(libev) system error";
+
+ if (syserr_cb)
+ syserr_cb (msg);
+ else
+ {
+ perror (msg);
+ abort ();
+ }
+}
+
+static void *(*alloc)(void *ptr, long size);
+
+void
+ev_set_allocator (void *(*cb)(void *ptr, long size))
+{
+ alloc = cb;
+}
+
+inline_speed void *
+ev_realloc (void *ptr, long size)
+{
+ ptr = alloc ? alloc (ptr, size) : realloc (ptr, size);
+
+ if (!ptr && size)
+ {
+ fprintf (stderr, "libev: cannot allocate %ld bytes, aborting.", size);
+ abort ();
+ }
+
+ return ptr;
+}
+
+#define ev_malloc(size) ev_realloc (0, (size))
+#define ev_free(ptr) ev_realloc ((ptr), 0)
+
+/*****************************************************************************/
+
+typedef struct
+{
+ WL head;
+ unsigned char events;
+ unsigned char reify;
+#if EV_SELECT_IS_WINSOCKET
+ SOCKET handle;
+#endif
+} ANFD;
+
+typedef struct
+{
+ W w;
+ int events;
+} ANPENDING;
+
+#if EV_USE_INOTIFY
+typedef struct
+{
+ WL head;
+} ANFS;
+#endif
+
+#if EV_MULTIPLICITY
+
+ struct ev_loop
+ {
+ ev_tstamp ev_rt_now;
+ #define ev_rt_now ((loop)->ev_rt_now)
+ #define VAR(name,decl) decl;
+ #include "ev_vars.h"
+ #undef VAR
+ };
+ #include "ev_wrap.h"