void noinline
ev_embed_sweep (EV_P_ ev_embed *w)
{
- ev_loop (w->loop, EVLOOP_NONBLOCK);
+ ev_loop (w->other, EVLOOP_NONBLOCK);
}
static void
return;
{
- struct ev_loop *loop = w->loop;
+ struct ev_loop *loop = w->other;
assert (("loop to be embedded is not embeddable", backend & ev_embeddable_backends ()));
ev_io_init (&w->io, embed_cb, backend_fd, EV_READ);
}
}
}
+#if EV_MULTIPLICITY
+ #include "ev_wrap.h"
+#endif
+
#ifdef __cplusplus
}
#endif
EV_WATCHER (ev_embed)
ev_io io; /* private */
- struct ev_loop *loop; /* ro */
+ struct ev_loop *other; /* ro */
} ev_embed;
#endif
#define ev_idle_set(ev) /* nop, yes, this is a serious in-joke */
#define ev_prepare_set(ev) /* nop, yes, this is a serious in-joke */
#define ev_check_set(ev) /* nop, yes, this is a serious in-joke */
-#define ev_embed_set(ev,loop_) do { (ev)->loop = (loop_); } while (0)
+#define ev_embed_set(ev,other_) do { (ev)->other = (other_); } while (0)
#define ev_fork_set(ev) /* nop, yes, this is a serious in-joke */
#define ev_io_init(ev,cb,fd,events) do { ev_init ((ev), (cb)); ev_io_set ((ev),(fd),(events)); } while (0)
#define ev_idle_init(ev,cb) do { ev_init ((ev), (cb)); ev_idle_set ((ev)); } while (0)
#define ev_prepare_init(ev,cb) do { ev_init ((ev), (cb)); ev_prepare_set ((ev)); } while (0)
#define ev_check_init(ev,cb) do { ev_init ((ev), (cb)); ev_check_set ((ev)); } while (0)
-#define ev_embed_init(ev,cb,loop) do { ev_init ((ev), (cb)); ev_embed_set ((ev),(loop)); } while (0)
+#define ev_embed_init(ev,cb,other) do { ev_init ((ev), (cb)); ev_embed_set ((ev),(other)); } while (0)
#define ev_fork_init(ev,cb) do { ev_init ((ev), (cb)); ev_fork_set ((ev)); } while (0)
#define ev_is_pending(ev) (0 + ((ev_watcher *)(void *)(ev))->pending) /* ro, true when watcher is waiting for callback invocation */
similarly to C<ev_loop (embedded_loop, EVLOOP_NONBLOCK)>, but in the most
apropriate way for embedded loops.
-=item struct ev_loop *loop [read-only]
+=item struct ev_loop *other [read-only]
The embedded event loop.
Game Server, the EV perl module, the GNU Virtual Private Ethernet (gvpe)
and rxvt-unicode.
-The goal is to enable you to just copy the neecssary files into your
+The goal is to enable you to just copy the necessary files into your
source directory without having to change even a single line in them, so
you can easily upgrade by simply copying (or having a checked-out copy of
libev somewhere in your source tree).
/* DO NOT EDIT, automatically generated by update_ev_wrap */
+#ifndef EV_WRAP_H
+#define EV_WRAP_H
#define now_floor ((loop)->now_floor)
#define mn_now ((loop)->mn_now)
#define rtmn_diff ((loop)->rtmn_diff)
#define backend ((loop)->backend)
#define activecnt ((loop)->activecnt)
-#define loop_count ((loop)->loop_count);
+#define loop_count ((loop)->loop_count)
#define backend_fudge ((loop)->backend_fudge)
#define backend_modify ((loop)->backend_modify)
#define backend_poll ((loop)->backend_poll)
#define fs_fd ((loop)->fs_fd)
#define fs_w ((loop)->fs_w)
#define fs_hash ((loop)->fs_hash)
+#else
+#undef EV_WRAP_H
+#undef now_floor
+#undef mn_now
+#undef rtmn_diff
+#undef backend
+#undef activecnt
+#undef loop_count
+#undef backend_fudge
+#undef backend_modify
+#undef backend_poll
+#undef backend_fd
+#undef curpid
+#undef postfork
+#undef vec_ri
+#undef vec_ro
+#undef vec_wi
+#undef vec_wo
+#undef vec_max
+#undef polls
+#undef pollmax
+#undef pollcnt
+#undef pollidxs
+#undef pollidxmax
+#undef epoll_events
+#undef epoll_eventmax
+#undef kqueue_changes
+#undef kqueue_changemax
+#undef kqueue_changecnt
+#undef kqueue_events
+#undef kqueue_eventmax
+#undef port_events
+#undef port_eventmax
+#undef anfds
+#undef anfdmax
+#undef pendings
+#undef pendingmax
+#undef pendingcnt
+#undef fdchanges
+#undef fdchangemax
+#undef fdchangecnt
+#undef timers
+#undef timermax
+#undef timercnt
+#undef periodics
+#undef periodicmax
+#undef periodiccnt
+#undef idles
+#undef idlemax
+#undef idlecnt
+#undef idleall
+#undef prepares
+#undef preparemax
+#undef preparecnt
+#undef checks
+#undef checkmax
+#undef checkcnt
+#undef forks
+#undef forkmax
+#undef forkcnt
+#undef fs_fd
+#undef fs_w
+#undef fs_hash
+#endif
#!/bin/sh
(
- echo '#define VAR(name,decl) define name ((loop)->name)'
+ echo '#define VAR(name,decl) name'
echo '#define EV_GENWRAP 1'
cat ev_vars.h
-) | cc -E -o - - | sed -n -e 's/define/#define/p' | (
- echo "/* DO NOT EDIT, automatically generated by update_ev_wrap */"
- cat
-) > ev_wrap.h
+) | cc -E -o - - | perl -ne '
+ while (<>) {
+ push @syms, $1 if /(^\w+)/;
+ }
+ print "/* DO NOT EDIT, automatically generated by update_ev_wrap */\n",
+ "#ifndef EV_WRAP_H\n",
+ "#define EV_WRAP_H\n",
+ (map "#define $_ ((loop)->$_)\n", @syms),
+ "#else\n",
+ "#undef EV_WRAP_H\n",
+ (map "#undef $_\n", @syms),
+ "#endif\n";
+' >ev_wrap.h