aboutsummaryrefslogtreecommitdiff
path: root/cglibivy.c
diff options
context:
space:
mode:
authorbuisson2005-04-29 09:35:43 +0000
committerbuisson2005-04-29 09:35:43 +0000
commit22c1e6dbe7cf74936e5ca29eadeff81312ccc506 (patch)
tree3304815b956eb5c76674fa2763d3da8a2e73394f /cglibivy.c
parent23abb4b87c7e40ed259dd02f653516f60e55ade4 (diff)
downloadivy-ocaml-22c1e6dbe7cf74936e5ca29eadeff81312ccc506.zip
ivy-ocaml-22c1e6dbe7cf74936e5ca29eadeff81312ccc506.tar.gz
ivy-ocaml-22c1e6dbe7cf74936e5ca29eadeff81312ccc506.tar.bz2
ivy-ocaml-22c1e6dbe7cf74936e5ca29eadeff81312ccc506.tar.xz
Initial revision
Diffstat (limited to 'cglibivy.c')
-rw-r--r--cglibivy.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/cglibivy.c b/cglibivy.c
new file mode 100644
index 0000000..64266e8
--- /dev/null
+++ b/cglibivy.c
@@ -0,0 +1,36 @@
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include <getopt.h>
+#include <timer.h>
+#include <glib.h>
+#include <caml/mlvalues.h>
+#include <caml/fail.h>
+#include <caml/callback.h>
+#include <caml/memory.h>
+#include <caml/alloc.h>
+#include "ivyglibloop.h"
+
+value ivy_GtkmainLoop(value unit)
+{
+ g_main_loop_run(g_main_loop_new(NULL, FALSE));
+ return Val_unit;
+}
+
+extern void cb_delete_channel(void *delete_read);
+extern void cb_read_channel(Channel ch, HANDLE fd, void *closure);
+
+value ivy_GtkchannelSetUp(value fd, value closure_name)
+{
+ Channel c;
+ value * closure = caml_named_value(String_val(closure_name));
+
+ c = IvyGlibChannelSetUp((HANDLE)Int_val(fd), (void*)closure, cb_delete_channel, cb_read_channel);
+ return Val_int(c);
+}
+
+value ivy_GtkchannelClose(value ch)
+{
+ IvyGlibChannelClose((Channel)Int_val(ch));
+ return Val_unit;
+}