summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorroot <root>2007-11-09 20:55:09 +0000
committerroot <root>2007-11-09 20:55:09 +0000
commitc4977e2742acfd90d4c4abd068f1c9e284951ef5 (patch)
tree7525b5878eaaa78390faf267cf806f950d83f47b
parentc20764a666b81af46b955c75eef0f6b088c821b0 (diff)
*** empty log message ***
-rw-r--r--README.embed32
-rw-r--r--ev.c2
-rw-r--r--ev.h18
3 files changed, 35 insertions, 17 deletions
diff --git a/README.embed b/README.embed
index 9874f0f..2980a96 100644
--- a/README.embed
+++ b/README.embed
@@ -75,18 +75,6 @@ PREPROCESSOR SYMBOLS
will also not define any of the structs usually found in "event.h"
that are not directly supported by libev code alone.
- EV_H
-
- The name of the ev.h header file used to include it. The default
- if undefined is <ev.h> in event.h and "ev.h" in ev.c. This can
- be used to virtually rename the ev.h header file in case of
- conflicts.
-
- EV_EVENT_H
-
- Similarly to EV_H, this macro cna be used to override event.c's idea
- of how the event.h header can be found.
-
EV_USE_MONOTONIC
If undefined or defined to be "1", libev will try to detect the
@@ -142,6 +130,18 @@ PREPROCESSOR SYMBOLS
will be detected at runtime and routed around by disabling this
backend.
+ EV_H
+
+ The name of the ev.h header file used to include it. The default
+ if undefined is <ev.h> in event.h and "ev.h" in ev.c. This can
+ be used to virtually rename the ev.h header file in case of
+ conflicts.
+
+ EV_EVENT_H
+
+ Similarly to EV_H, this macro cna be used to override event.c's idea
+ of how the event.h header can be found.
+
EV_COMMON
By default, all watchers have a "void *data" member. By redefining
@@ -170,6 +170,14 @@ PREPROCESSOR SYMBOLS
event loop pointer argument. Instead, all functions act on the
single default loop.
+ EV_CB_DECLARE(type)
+ EV_CB_INVOKE(watcher,revents)
+
+ Can be used to change the callback member declaration in each
+ watcher, and the way callbacks are invoked. Must expand to a struct
+ member definition and a statement, respectively. See the ev.v
+ header file for their default definitions.
+
EXAMPLES
For a real-world example of a program the includes libev
diff --git a/ev.c b/ev.c
index 20ad7e4..dedd4f3 100644
--- a/ev.c
+++ b/ev.c
@@ -950,7 +950,7 @@ call_pending (EV_P)
if (p->w)
{
p->w->pending = 0;
- p->w->cb (EV_A_ p->w, p->events);
+ EV_CB_INVOKE (p->w, p->events);
}
}
}
diff --git a/ev.h b/ev.h
index a6065d0..37764cd 100644
--- a/ev.h
+++ b/ev.h
@@ -87,6 +87,13 @@ struct ev_loop;
#define EV_VERSION_MAJOR 1
#define EV_VERSION_MINOR 1
+#ifndef EV_CB_DECLARE
+# define EV_CB_DECLARE(type) void (*cb)(EV_P_ struct type *w, int revents)
+#endif
+#ifndef EV_CB_INVOKE
+# define EV_CB_INVOKE(watcher,revents) (watcher)->cb (EV_A_ (watcher), (revents))
+#endif
+
/*
* struct member types:
* private: you can look at them, but not change them, and they might not mean anything to you.
@@ -100,7 +107,7 @@ struct ev_loop;
int pending; /* private */ \
int priority; /* private */ \
EV_COMMON; /* rw */ \
- void (*cb)(EV_P_ struct type *, int revents) /* private */ /* gets invoked with an eventmask */
+ EV_CB_DECLARE (type) /* private */
#define EV_WATCHER_LIST(type) \
EV_WATCHER (type); \
@@ -111,17 +118,20 @@ struct ev_loop;
ev_tstamp at /* private */
/* base class, nothing to see here unless you subclass */
-struct ev_watcher {
+struct ev_watcher
+{
EV_WATCHER (ev_watcher);
};
/* base class, nothing to see here unless you subclass */
-struct ev_watcher_list {
+struct ev_watcher_list
+{
EV_WATCHER_LIST (ev_watcher_list);
};
/* base class, nothing to see here unless you subclass */
-struct ev_watcher_time {
+struct ev_watcher_time
+{
EV_WATCHER_TIME (ev_watcher_time);
};