diff options
-rw-r--r-- | Makefile | 11 | ||||
-rw-r--r-- | civy.c | 4 | ||||
-rw-r--r-- | ctkivy.c | 21 | ||||
-rw-r--r-- | examples/Makefile | 18 | ||||
-rw-r--r-- | examples/tkivyprobe.ml | 2 |
5 files changed, 33 insertions, 23 deletions
@@ -36,6 +36,7 @@ OCAMLOPTFLAGS= CFLAGS+=-Wall OCAMLINC=-I `ocamlc -where` GLIBINC=`pkg-config --cflags glib-2.0` +TKINC=-I/usr/include/tcl # by default use fPIC on all systems FPIC ?= -fPIC @@ -70,7 +71,7 @@ TKIVYCMX= $(TKIVY:.ml=.cmx) IVYLIBS = ivy-ocaml.cma ivy-ocaml.cmxa GLIBIVYLIBS = glibivy-ocaml.cma glibivy-ocaml.cmxa -TKLIBS = tkivy.cma tkivy.cmxa +TKLIBS = tkivy-ocaml.cma tkivy-ocaml.cmxa IVYSTATIC = libivy-ocaml.a ivy-ocaml.a GLIBIVYSTATIC = libglibivy-ocaml.a glibivy-ocaml.a @@ -78,7 +79,7 @@ LIBS = ivy-ocaml.cma glibivy-ocaml.cma XLIBS = ivy-ocaml.cmxa glibivy-ocaml.cmxa -all : $(LIBS) $(XLIBS) +all : $(LIBS) $(XLIBS) $(TKLIBS) deb : dpkg-buildpackage -rfakeroot @@ -123,10 +124,10 @@ glibivy-ocaml.cmxa : $(GLIBIVYCMX) civy.o cglibivy.o $(OCAMLMKLIB) -o glibivy-ocaml $^ $(LIBRARYS) -lglibivy `pkg-config --libs glib-2.0` -lpcre tkivy-ocaml.cma : $(TKIVYCMO) civy.o ctkivy.o - $(OCAMLMKLIB) -o tkivy-ocaml $^ $(LIBRARYS) -livy -ltclivy + $(OCAMLMKLIB) -o tkivy-ocaml $^ $(LIBRARYS) -ltclivy tkivy-ocaml.cmxa : $(TKIVYCMX) civy.o ctkivy.o - $(OCAMLMKLIB) -o tkivy-ocaml $^ $(LIBRARYS) -livy -ltclivy + $(OCAMLMKLIB) -o tkivy-ocaml $^ $(LIBRARYS) -ltclivy .SUFFIXES: @@ -135,7 +136,7 @@ tkivy-ocaml.cmxa : $(TKIVYCMX) civy.o ctkivy.o .ml.cmo : $(OCAMLC) $(OCAMLFLAGS) $(INCLUDES) -c $< .c.o : - $(CC) -Wall -c $(FPIC) -I $(OSX_MACPORTS_PREFIX)/include/ $(OCAMLINC) $(GLIBINC) $< + $(CC) -Wall -c $(FPIC) -I $(OSX_MACPORTS_PREFIX)/include/ $(OCAMLINC) $(GLIBINC) $(TKINC) $< .mli.cmi : $(OCAMLMLI) $(OCAMLFLAGS) -c $< .ml.cmx : @@ -13,7 +13,7 @@ value ivy_sendMsg(value msg) { - IvySendMsg(String_val(msg)); + IvySendMsg("%s", String_val(msg)); return Val_unit; } @@ -60,7 +60,7 @@ void ClosureCallback(IvyClientPtr app, void *closure, int argc, char **argv) value ivy_bindMsg(value cb_name, value regexp) { value * closure = caml_named_value(String_val(cb_name)); - MsgRcvPtr id = IvyBindMsg(ClosureCallback, (void*)closure, String_val(regexp)); + MsgRcvPtr id = IvyBindMsg(ClosureCallback, (void*)closure, "%s", String_val(regexp)); return Val_long(id); } @@ -2,16 +2,16 @@ #include <string.h> #include <stdio.h> #include <getopt.h> -#include <timer.h> +#include <Ivy/timer.h> +#include <Ivy/ivychannel.h> +#include <Ivy/ivytcl.h> +#include <Ivy/version.h> +#include <tk.h> #include <caml/mlvalues.h> #include <caml/fail.h> #include <caml/callback.h> #include <caml/memory.h> #include <caml/alloc.h> -#include "ivytcl.h" - -extern void cb_delete_channel(void *delete_read); -extern void cb_read_channel(Channel ch, IVY_HANDLE fd, void *closure); value ivy_TclmainLoop(value unit) { @@ -19,18 +19,25 @@ value ivy_TclmainLoop(value unit) return Val_unit; } +extern void cb_delete_channel(void *delete_read); +extern void cb_read_channel(Channel ch, IVY_HANDLE fd, void *closure); +extern void cb_write_channel(Channel ch, IVY_HANDLE fd, void *closure); value ivy_TclchannelSetUp(value fd, value closure_name) { Channel c; value * closure = caml_named_value(String_val(closure_name)); - c = IvyTclChannelSetUp((IVY_HANDLE)Int_val(fd), (void*)closure, cb_delete_channel, cb_read_channel); +#if IVYMINOR_VERSION == 8 + c = IvyChannelAdd((IVY_HANDLE)Int_val(fd), (void*)closure, cb_delete_channel, cb_read_channel); +#else + c = IvyChannelAdd((IVY_HANDLE)Int_val(fd), (void*)closure, cb_delete_channel, cb_read_channel, cb_write_channel); +#endif return Val_int(c); } value ivy_TclchannelClose(value ch) { - IvyTclChannelClose((Channel)Int_val(ch)); + IvyChannelRemove((Channel)Long_val(ch)); return Val_unit; } diff --git a/examples/Makefile b/examples/Makefile index d110fd0..a25375e 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -1,11 +1,11 @@ # $Id$ -OCAMLC = ocamlc -I .. -OCAMLMLI = ocamlc -I .. -OCAMLOPT = ocamlopt -OCAMLDEP=ocamldep +OCAMLC = ocamlfind ocamlc -I .. +OCAMLMLI = ocamlfind ocamlc -I .. +OCAMLOPT = ocamlfind ocamlopt +OCAMLDEP = ocamlfind ocamldep -all: ivyprobe.out glibivyprobe.out +all: ivyprobe.out glibivyprobe.out tkivyprobe.out ivyprobe.out : ivyprobe.cmo ivyivyprobe.cmo $(OCAMLC) -custom -o $@ unix.cma ivy-ocaml.cma $^ @@ -13,9 +13,11 @@ ivyprobe.out : ivyprobe.cmo ivyivyprobe.cmo glibivyprobe.out : ivyprobe.cmo glibivyprobe.cmo $(OCAMLC) -custom -o $@ unix.cma glibivy-ocaml.cma $^ -#tkivyprobe.out : ivyprobe.cmo tkivyprobe.cmo -# $(OCAMLC) -custom -o $@ unix.cma -I +labltk labltk.cma -I . $^ -#tkivyprobe.cmo : OCAMLFLAGS=-I +labltk +tkivyprobe.out : ivyprobe.cmo tkivyprobe.cmo + $(OCAMLC) -custom -o $@ unix.cma -I +labltk labltk.cma tkivy-ocaml.cma $^ + +tkivyprobe.cmo : tkivyprobe.ml + $(OCAMLC) -package unix,labltk -c $< %.cmo : %.ml $(OCAMLC) -c $< diff --git a/examples/tkivyprobe.ml b/examples/tkivyprobe.ml index 67ee3aa..150ccdb 100644 --- a/examples/tkivyprobe.ml +++ b/examples/tkivyprobe.ml @@ -1,6 +1,6 @@ let _ = Ivyprobe.init (); - let top = Tk.openTk () in + let _ = Tk.openTk () in try ignore (TkIvy.set_up_channel Unix.stdin Ivy.stop (fun _ -> Ivyprobe.read stdin)); TkIvy.main () |