From owner-freebsd-ports-bugs@FreeBSD.ORG Sun Nov 29 21:10:01 2009 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B9EAA10656A7 for ; Sun, 29 Nov 2009 21:10:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 95F648FC23 for ; Sun, 29 Nov 2009 21:10:01 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id nATLA1ll081775 for ; Sun, 29 Nov 2009 21:10:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id nATLA17P081774; Sun, 29 Nov 2009 21:10:01 GMT (envelope-from gnats) Resent-Date: Sun, 29 Nov 2009 21:10:01 GMT Resent-Message-Id: <200911292110.nATLA17P081774@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, soulcatcher Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AE557106568B for ; Sun, 29 Nov 2009 21:07:08 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id 9C7A28FC1E for ; Sun, 29 Nov 2009 21:07:08 +0000 (UTC) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.3/8.14.3) with ESMTP id nATL78J4057364 for ; Sun, 29 Nov 2009 21:07:08 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.3/8.14.3/Submit) id nATL784l057363; Sun, 29 Nov 2009 21:07:08 GMT (envelope-from nobody) Message-Id: <200911292107.nATL784l057363@www.freebsd.org> Date: Sun, 29 Nov 2009 21:07:08 GMT From: soulcatcher To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: ports/141006: [patch] devel/ocaml-event: update to 0.6.0 X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Nov 2009 21:10:01 -0000 >Number: 141006 >Category: ports >Synopsis: [patch] devel/ocaml-event: update to 0.6.0 >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: update >Submitter-Id: current-users >Arrival-Date: Sun Nov 29 21:10:01 UTC 2009 >Closed-Date: >Last-Modified: >Originator: soulcatcher >Release: 7.2-STABLE >Organization: >Environment: FreeBSD xxx.org 7.2-STABLE FreeBSD 7.2-STABLE #5: Sun Nov 22 21:02:42 MSK 2009 root@xxx.org:/usr/obj/usr/src/sys/GENERIC amd64 >Description: update devel/ocaml-event: 0.5.0_7 -> 0.6.0 >How-To-Repeat: >Fix: Patch attached with submission follows: diff -ruN ocaml-event.bak/Makefile ocaml-event/Makefile --- ocaml-event.bak/Makefile 2009-11-29 23:47:17.000000000 +0300 +++ ocaml-event/Makefile 2009-11-30 00:00:27.000000000 +0300 @@ -6,8 +6,7 @@ # PORTNAME= event -PORTVERSION= 0.5.0 -PORTREVISION= 7 +PORTVERSION= 0.6.0 CATEGORIES= devel MASTER_SITES= http://www.xs4all.nl/~mmzeeman/ocaml/ PKGNAMEPREFIX= ocaml- @@ -31,16 +30,17 @@ EXAMPLE_FILES= \ Makefile \ fifo_example.ml \ + http_server.ml \ signal_example.ml LIB_FILES= \ - libevent.a \ - libevent.cmxa \ - libmlevent.a \ - libevent.cma \ - libevent.mli \ - libevent.cmi + liboevent.a \ + liboevent.cmxa \ + libmloevent.a \ + liboevent.cma \ + liboevent.mli \ + liboevent.cmi LIB_STUB_FILES= \ - dllmlevent.so + dllmloevent.so # examples to install PLIST_DIRS+= ${EXAMPLESDIR:S,^${PREFIX}/,,} @@ -65,7 +65,7 @@ ${WRKSRC}/Makefile pre-build: -.for file in libevent.cmi +.for file in liboevent.cmi @cd ${WRKSRC} && ${GMAKE} ${file} .endfor diff -ruN ocaml-event.bak/distinfo ocaml-event/distinfo --- ocaml-event.bak/distinfo 2009-11-29 23:47:17.000000000 +0300 +++ ocaml-event/distinfo 2009-11-29 23:51:05.000000000 +0300 @@ -1,3 +1,3 @@ -MD5 (ocaml-event-0.5.0.tar.gz) = 1c6478d39817a90faa59a353018b082d -SHA256 (ocaml-event-0.5.0.tar.gz) = 0b199f5494ca7647ca70ed6b53da96a252c385b6ba3f1ff0c934e328b2e03065 -SIZE (ocaml-event-0.5.0.tar.gz) = 7040 +MD5 (ocaml-event-0.6.0.tar.gz) = ae06ace4a05b8f32203de4641bed7c99 +SHA256 (ocaml-event-0.6.0.tar.gz) = 06ffb1d8621530ef3dd2ed8aa931643783586cfc91433b69a7e338931385dc8e +SIZE (ocaml-event-0.6.0.tar.gz) = 7664 diff -ruN ocaml-event.bak/work/.PLIST.flattened ocaml-event/work/.PLIST.flattened --- ocaml-event.bak/work/.PLIST.flattened 1970-01-01 03:00:00.000000000 +0300 +++ ocaml-event/work/.PLIST.flattened 2009-11-30 00:00:35.000000000 +0300 @@ -0,0 +1,25 @@ +/usr/local/share/examples/ocaml-event/Makefile +/usr/local/share/examples/ocaml-event/fifo_example.ml +/usr/local/share/examples/ocaml-event/http_server.ml +/usr/local/share/examples/ocaml-event/signal_example.ml +/usr/local/lib/ocaml/liboevent.a +/usr/local/lib/ocaml/liboevent.cmxa +/usr/local/lib/ocaml/libmloevent.a +/usr/local/lib/ocaml/liboevent.cma +/usr/local/lib/ocaml/liboevent.mli +/usr/local/lib/ocaml/liboevent.cmi +/usr/local/lib/ocaml/stublibs/dllmloevent.so +/usr/local/share/doc/ocaml-event/Liboevent.html +/usr/local/share/doc/ocaml-event/README +/usr/local/share/doc/ocaml-event/index.html +/usr/local/share/doc/ocaml-event/index_attributes.html +/usr/local/share/doc/ocaml-event/index_class_types.html +/usr/local/share/doc/ocaml-event/index_classes.html +/usr/local/share/doc/ocaml-event/index_exceptions.html +/usr/local/share/doc/ocaml-event/index_methods.html +/usr/local/share/doc/ocaml-event/index_module_types.html +/usr/local/share/doc/ocaml-event/index_modules.html +/usr/local/share/doc/ocaml-event/index_types.html +/usr/local/share/doc/ocaml-event/index_values.html +/usr/local/share/doc/ocaml-event/style.css +/usr/local/share/doc/ocaml-event/type_Liboevent.html diff -ruN ocaml-event.bak/work/.PLIST.mktmp ocaml-event/work/.PLIST.mktmp --- ocaml-event.bak/work/.PLIST.mktmp 1970-01-01 03:00:00.000000000 +0300 +++ ocaml-event/work/.PLIST.mktmp 2009-11-30 00:00:33.000000000 +0300 @@ -0,0 +1,29 @@ +share/examples/ocaml-event/Makefile +share/examples/ocaml-event/fifo_example.ml +share/examples/ocaml-event/http_server.ml +share/examples/ocaml-event/signal_example.ml +lib/ocaml/liboevent.a +lib/ocaml/liboevent.cmxa +lib/ocaml/libmloevent.a +lib/ocaml/liboevent.cma +lib/ocaml/liboevent.mli +lib/ocaml/liboevent.cmi +lib/ocaml/stublibs/dllmloevent.so +@unexec rmdir %D/lib/ocaml/stublibs 2>/dev/null || true +@unexec rmdir %D/lib/ocaml 2>/dev/null || true +@dirrm share/examples/ocaml-event +share/doc/ocaml-event/Liboevent.html +share/doc/ocaml-event/README +share/doc/ocaml-event/index.html +share/doc/ocaml-event/index_attributes.html +share/doc/ocaml-event/index_class_types.html +share/doc/ocaml-event/index_classes.html +share/doc/ocaml-event/index_exceptions.html +share/doc/ocaml-event/index_methods.html +share/doc/ocaml-event/index_module_types.html +share/doc/ocaml-event/index_modules.html +share/doc/ocaml-event/index_types.html +share/doc/ocaml-event/index_values.html +share/doc/ocaml-event/style.css +share/doc/ocaml-event/type_Liboevent.html +@dirrm share/doc/ocaml-event diff -ruN ocaml-event.bak/work/.PLIST.objdump ocaml-event/work/.PLIST.objdump --- ocaml-event.bak/work/.PLIST.objdump 1970-01-01 03:00:00.000000000 +0300 +++ ocaml-event/work/.PLIST.objdump 2009-11-30 00:00:35.000000000 +0300 @@ -0,0 +1,40 @@ +In archive /usr/local/lib/ocaml/liboevent.a: + +liboevent.o: file format elf64-x86-64 + +In archive /usr/local/lib/ocaml/libmloevent.a: + +event_stubs.o: file format elf64-x86-64 + + +/usr/local/lib/ocaml/stublibs/dllmloevent.so: file format elf64-x86-64 + +DYNAMIC RELOCATION RECORDS +OFFSET TYPE VALUE +0000000000101440 R_X86_64_RELATIVE *ABS*+0x0000000000101440 +0000000000101448 R_X86_64_RELATIVE *ABS*+0x0000000000101898 +0000000000101460 R_X86_64_RELATIVE *ABS*+0x00000000000013a3 +0000000000101468 R_X86_64_RELATIVE *ABS*+0x00000000000012e3 +0000000000101470 R_X86_64_RELATIVE *ABS*+0x0000000000000e48 +0000000000101478 R_X86_64_RELATIVE *ABS*+0x0000000000000e5b +0000000000101940 R_X86_64_GLOB_DAT caml_local_roots +0000000000101948 R_X86_64_GLOB_DAT __cxa_finalize +0000000000101950 R_X86_64_GLOB_DAT _Jv_RegisterClasses +00000000001018c0 R_X86_64_JUMP_SLOT event_loop +00000000001018c8 R_X86_64_JUMP_SLOT caml_callback3 +00000000001018d0 R_X86_64_JUMP_SLOT caml_named_value +00000000001018d8 R_X86_64_JUMP_SLOT event_dispatch +00000000001018e0 R_X86_64_JUMP_SLOT __cxa_finalize +00000000001018e8 R_X86_64_JUMP_SLOT caml_stat_free +00000000001018f0 R_X86_64_JUMP_SLOT memset +00000000001018f8 R_X86_64_JUMP_SLOT caml_alloc_custom +0000000000101900 R_X86_64_JUMP_SLOT event_init +0000000000101908 R_X86_64_JUMP_SLOT event_add +0000000000101910 R_X86_64_JUMP_SLOT caml_stat_alloc +0000000000101918 R_X86_64_JUMP_SLOT event_del +0000000000101920 R_X86_64_JUMP_SLOT event_pending +0000000000101928 R_X86_64_JUMP_SLOT caml_invalid_argument +0000000000101930 R_X86_64_JUMP_SLOT event_set +0000000000101938 R_X86_64_JUMP_SLOT uerror + + diff -ruN ocaml-event.bak/work/ocaml-event-0.6.0/LICENCE ocaml-event/work/ocaml-event-0.6.0/LICENCE --- ocaml-event.bak/work/ocaml-event-0.6.0/LICENCE 1970-01-01 03:00:00.000000000 +0300 +++ ocaml-event/work/ocaml-event-0.6.0/LICENCE 2007-04-20 00:42:39.000000000 +0400 @@ -0,0 +1,22 @@ +Copyright (c) 2002, 2003 by Maas-Maarten Zeeman + +The package ocaml-event is copyright by Maas-Maarten Zeeman. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this document and the ocaml-event software ("the Software"), +to deal in the Software without restriction, including without +limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +The Software is provided ``as is'', without warranty of any kind, +express or implied, including but not limited to the warranties of +merchantability, fitness for a particular purpose and noninfringement. +In no event shall Maas-Maarten Zeeman be liable for any claim, damages +or other liability, whether in an action of contract, tort or +otherwise, arising from, out of or in connection with the Software or +the use or other dealings in the software. diff -ruN ocaml-event.bak/work/ocaml-event-0.6.0/META ocaml-event/work/ocaml-event-0.6.0/META --- ocaml-event.bak/work/ocaml-event-0.6.0/META 1970-01-01 03:00:00.000000000 +0300 +++ ocaml-event/work/ocaml-event-0.6.0/META 2007-04-20 00:42:39.000000000 +0400 @@ -0,0 +1,7 @@ +name = "event" +version = "0.5.0" +description = "OCaml wrapper for libevent" +requires = "unix" +archive(byte) = "libevent.cma" +archive(native) = "libevent.cmxa" +linkopts = "" diff -ruN ocaml-event.bak/work/ocaml-event-0.6.0/Makefile ocaml-event/work/ocaml-event-0.6.0/Makefile --- ocaml-event.bak/work/ocaml-event-0.6.0/Makefile 1970-01-01 03:00:00.000000000 +0300 +++ ocaml-event/work/ocaml-event-0.6.0/Makefile 2009-11-29 23:55:29.000000000 +0300 @@ -0,0 +1,100 @@ +# +# $Id: Makefile,v 1.2 2009-11-26 08:49:02 maas Exp $ +# + +# Change this to match your libevent installation. +EVENT_LIB=-levent +EVENT_LIBDIR=/usr/local/lib +EVENT_INCDIR=/usr/local/include + +NAME=liboevent +OBJECTS=liboevent.cmo +XOBJECTS=$(OBJECTS:.cmo=.cmx) +C_OBJECTS=event_stubs.o + +ARCHIVE=$(NAME).cma +XARCHIVE=$(ARCHIVE:.cma=.cmxa) +CARCHIVE_NAME=mloevent +CARCHIVE=lib$(CARCHIVE_NAME).a + +# Flags for the C compiler. +CFLAGS=-O2 -fno-strict-aliasing -pipe -march=nocona -I$(EVENT_INCDIR) + +OCAMLC=ocamlc +OCAMLOPT=ocamlopt +OCAMLDEP=ocamldep +OCAMLMKLIB=ocamlmklib +OCAMLDOC=ocamldoc +OCAMLFIND=ocamlfind + +.PHONY: all +all: $(ARCHIVE) +.PHONY: allopt +allopt: $(XARCHIVE) + +depend: *.c *.ml *.mli + gcc -MM *.c > depend + $(OCAMLDEP) *.mli *.ml >> depend + +## Library creation +$(CARCHIVE): $(C_OBJECTS) + $(OCAMLMKLIB) -oc $(CARCHIVE_NAME) $(C_OBJECTS) \ + -L$(EVENT_LIBDIR) $(EVENT_LIB) +$(ARCHIVE): $(CARCHIVE) $(OBJECTS) + $(OCAMLMKLIB) -o $(NAME) $(OBJECTS) -oc $(CARCHIVE_NAME) \ + -L$(EVENT_LIBDIR) $(EVENT_LIB) +$(XARCHIVE): $(CARCHIVE) $(XOBJECTS) + $(OCAMLMKLIB) -o $(NAME) $(XOBJECTS) -oc $(CARCHIVE_NAME) \ + -L$(EVENT_LIBDIR) $(EVENT_LIB) + +## Installation +.PHONY: install +install: all + { test ! -f $(XARCHIVE) || extra="$(XARCHIVE) $(NAME).a"; }; \ + $(OCAMLFIND) install $(NAME) META $(NAME).cmi $(NAME).mli $(ARCHIVE) \ + dll$(CARCHIVE_NAME).so lib$(CARCHIVE_NAME).a $$extra + +.PHONY: uninstall +uninstall: + $(OCAMLFIND) remove $(NAME) + +## Documentation +.PHONY: doc +doc: FORCE + cd doc; $(OCAMLDOC) -html -I .. ../$(NAME).mli + +## Testing +.PHONY: testall +testall: test testopt +.PHONY: test +test: unittest + ./unittest +.PHONY: testopt +testopt: unittest.opt + ./unittest.opt +unittest: all unittest.ml + $(OCAMLFIND) ocamlc -o unittest -package oUnit -cclib -L. -linkpkg \ + $(ARCHIVE) unittest.ml +unittest.opt: allopt unittest.ml + $(OCAMLFIND) ocamlopt -o unittest.opt -package oUnit -cclib -L. -linkpkg \ + $(XARCHIVE) unittest.ml + +## Cleaning up +.PHONY: clean +clean:: + rm -f *~ *.cm* *.o *.a *.so doc/*.html doc/*.css depend \ + unittest unittest.opt + +FORCE: + +.SUFFIXES: .ml .mli .cmo .cmi .cmx + +.mli.cmi: + $(OCAMLC) -c $(COMPFLAGS) $< +.ml.cmo: + $(OCAMLC) -c $(COMPLAGS) -nolabels $< +.ml.cmx: + $(OCAMLOPT) -c $(COMPFLAGS) -nolabels $< +.c.o: + $(OCAMLC) -c -ccopt "$(CFLAGS)" $< + diff -ruN ocaml-event.bak/work/ocaml-event-0.6.0/Makefile.bak ocaml-event/work/ocaml-event-0.6.0/Makefile.bak --- ocaml-event.bak/work/ocaml-event-0.6.0/Makefile.bak 1970-01-01 03:00:00.000000000 +0300 +++ ocaml-event/work/ocaml-event-0.6.0/Makefile.bak 2009-11-29 23:55:29.000000000 +0300 @@ -0,0 +1,100 @@ +# +# $Id: Makefile,v 1.2 2009-11-26 08:49:02 maas Exp $ +# + +# Change this to match your libevent installation. +EVENT_LIB=-levent +EVENT_LIBDIR=/usr/local/lib +EVENT_INCDIR=/usr/local/include + +NAME=liboevent +OBJECTS=liboevent.cmo +XOBJECTS=$(OBJECTS:.cmo=.cmx) +C_OBJECTS=event_stubs.o + +ARCHIVE=$(NAME).cma +XARCHIVE=$(ARCHIVE:.cma=.cmxa) +CARCHIVE_NAME=mloevent +CARCHIVE=lib$(CARCHIVE_NAME).a + +# Flags for the C compiler. +CFLAGS=-DFULL_UNROLL -O2 -I$(EVENT_INCDIR) + +OCAMLC=ocamlc +OCAMLOPT=ocamlopt +OCAMLDEP=ocamldep +OCAMLMKLIB=ocamlmklib +OCAMLDOC=ocamldoc +OCAMLFIND=ocamlfind + +.PHONY: all +all: $(ARCHIVE) +.PHONY: allopt +allopt: $(XARCHIVE) + +depend: *.c *.ml *.mli + gcc -MM *.c > depend + $(OCAMLDEP) *.mli *.ml >> depend + +## Library creation +$(CARCHIVE): $(C_OBJECTS) + $(OCAMLMKLIB) -oc $(CARCHIVE_NAME) $(C_OBJECTS) \ + -L$(EVENT_LIBDIR) $(EVENT_LIB) +$(ARCHIVE): $(CARCHIVE) $(OBJECTS) + $(OCAMLMKLIB) -o $(NAME) $(OBJECTS) -oc $(CARCHIVE_NAME) \ + -L$(EVENT_LIBDIR) $(EVENT_LIB) +$(XARCHIVE): $(CARCHIVE) $(XOBJECTS) + $(OCAMLMKLIB) -o $(NAME) $(XOBJECTS) -oc $(CARCHIVE_NAME) \ + -L$(EVENT_LIBDIR) $(EVENT_LIB) + +## Installation +.PHONY: install +install: all + { test ! -f $(XARCHIVE) || extra="$(XARCHIVE) $(NAME).a"; }; \ + $(OCAMLFIND) install $(NAME) META $(NAME).cmi $(NAME).mli $(ARCHIVE) \ + dll$(CARCHIVE_NAME).so lib$(CARCHIVE_NAME).a $$extra + +.PHONY: uninstall +uninstall: + $(OCAMLFIND) remove $(NAME) + +## Documentation +.PHONY: doc +doc: FORCE + cd doc; $(OCAMLDOC) -html -I .. ../$(NAME).mli + +## Testing +.PHONY: testall +testall: test testopt +.PHONY: test +test: unittest + ./unittest +.PHONY: testopt +testopt: unittest.opt + ./unittest.opt +unittest: all unittest.ml + $(OCAMLFIND) ocamlc -o unittest -package oUnit -cclib -L. -linkpkg \ + $(ARCHIVE) unittest.ml +unittest.opt: allopt unittest.ml + $(OCAMLFIND) ocamlopt -o unittest.opt -package oUnit -cclib -L. -linkpkg \ + $(XARCHIVE) unittest.ml + +## Cleaning up +.PHONY: clean +clean:: + rm -f *~ *.cm* *.o *.a *.so doc/*.html doc/*.css depend \ + unittest unittest.opt + +FORCE: + +.SUFFIXES: .ml .mli .cmo .cmi .cmx + +.mli.cmi: + $(OCAMLC) -c $(COMPFLAGS) $< +.ml.cmo: + $(OCAMLC) -c $(COMPLAGS) -nolabels $< +.ml.cmx: + $(OCAMLOPT) -c $(COMPFLAGS) -nolabels $< +.c.o: + $(OCAMLC) -c -ccopt "$(CFLAGS)" $< + diff -ruN ocaml-event.bak/work/ocaml-event-0.6.0/Makefile.orig ocaml-event/work/ocaml-event-0.6.0/Makefile.orig --- ocaml-event.bak/work/ocaml-event-0.6.0/Makefile.orig 1970-01-01 03:00:00.000000000 +0300 +++ ocaml-event/work/ocaml-event-0.6.0/Makefile.orig 2009-11-26 11:49:02.000000000 +0300 @@ -0,0 +1,101 @@ +# +# $Id: Makefile,v 1.2 2009-11-26 08:49:02 maas Exp $ +# + +# Change this to match your libevent installation. +EVENT_LIB=-levent +EVENT_LIBDIR=/usr/local/lib +EVENT_INCDIR=/usr/local/include + +NAME=liboevent +OBJECTS=liboevent.cmo +XOBJECTS=$(OBJECTS:.cmo=.cmx) +C_OBJECTS=event_stubs.o + +ARCHIVE=$(NAME).cma +XARCHIVE=$(ARCHIVE:.cma=.cmxa) +CARCHIVE_NAME=mloevent +CARCHIVE=lib$(CARCHIVE_NAME).a + +# Flags for the C compiler. +CFLAGS=-DFULL_UNROLL -O2 -I$(EVENT_INCDIR) + +OCAMLC=ocamlc +OCAMLOPT=ocamlopt +OCAMLDEP=ocamldep +OCAMLMKLIB=ocamlmklib +OCAMLDOC=ocamldoc +OCAMLFIND=ocamlfind + +.PHONY: all +all: $(ARCHIVE) +.PHONY: allopt +allopt: $(XARCHIVE) + +depend: *.c *.ml *.mli + gcc -MM *.c > depend + $(OCAMLDEP) *.mli *.ml >> depend + +## Library creation +$(CARCHIVE): $(C_OBJECTS) + $(OCAMLMKLIB) -oc $(CARCHIVE_NAME) $(C_OBJECTS) \ + -L$(EVENT_LIBDIR) $(EVENT_LIB) +$(ARCHIVE): $(CARCHIVE) $(OBJECTS) + $(OCAMLMKLIB) -o $(NAME) $(OBJECTS) -oc $(CARCHIVE_NAME) \ + -L$(EVENT_LIBDIR) $(EVENT_LIB) +$(XARCHIVE): $(CARCHIVE) $(XOBJECTS) + $(OCAMLMKLIB) -o $(NAME) $(XOBJECTS) -oc $(CARCHIVE_NAME) \ + -L$(EVENT_LIBDIR) $(EVENT_LIB) + +## Installation +.PHONY: install +install: all + { test ! -f $(XARCHIVE) || extra="$(XARCHIVE) $(NAME).a"; }; \ + $(OCAMLFIND) install $(NAME) META $(NAME).cmi $(NAME).mli $(ARCHIVE) \ + dll$(CARCHIVE_NAME).so lib$(CARCHIVE_NAME).a $$extra + +.PHONY: uninstall +uninstall: + $(OCAMLFIND) remove $(NAME) + +## Documentation +.PHONY: doc +doc: FORCE + cd doc; $(OCAMLDOC) -html -I .. ../$(NAME).mli + +## Testing +.PHONY: testall +testall: test testopt +.PHONY: test +test: unittest + ./unittest +.PHONY: testopt +testopt: unittest.opt + ./unittest.opt +unittest: all unittest.ml + $(OCAMLFIND) ocamlc -o unittest -package oUnit -cclib -L. -linkpkg \ + $(ARCHIVE) unittest.ml +unittest.opt: allopt unittest.ml + $(OCAMLFIND) ocamlopt -o unittest.opt -package oUnit -cclib -L. -linkpkg \ + $(XARCHIVE) unittest.ml + +## Cleaning up +.PHONY: clean +clean:: + rm -f *~ *.cm* *.o *.a *.so doc/*.html doc/*.css depend \ + unittest unittest.opt + +FORCE: + +.SUFFIXES: .ml .mli .cmo .cmi .cmx + +.mli.cmi: + $(OCAMLC) -c $(COMPFLAGS) $< +.ml.cmo: + $(OCAMLC) -c $(COMPLAGS) -nolabels $< +.ml.cmx: + $(OCAMLOPT) -c $(COMPFLAGS) -nolabels $< +.c.o: + $(OCAMLC) -c -ccopt "$(CFLAGS)" $< + +include depend diff -ruN ocaml-event.bak/work/ocaml-event-0.6.0/README ocaml-event/work/ocaml-event-0.6.0/README --- ocaml-event.bak/work/ocaml-event-0.6.0/README 1970-01-01 03:00:00.000000000 +0300 +++ ocaml-event/work/ocaml-event-0.6.0/README 2007-04-20 00:42:39.000000000 +0400 @@ -0,0 +1,46 @@ + The ocaml-event library + +Overview + + Ocaml-Expat is a wrapper for the libevent API. The libevent API + provides a mechanism to execute a callback function when a specific + event occurs on a file descriptor or after a timeout has been + reached. Furthermore, libevent also support callbacks due to signals + or regular timeouts. Libevent is meant to replace the event loop + found in event driven network servers. An application just needs to + call event_dispatch() and then adds or removes events dynamically + without having to change the event loop. This wrapper makes the + libevent library available for ocaml programmers. + +Installation + + - Download, compile, and install libevent. + See http://www.monkey.org/~provos/libevent/ + + - Edit the variables at the beginning of the Makefile to reflect the + location where libevent is installed on your system. + + - Do make depend; make all + + - If the Objective Caml native-code compiler is available on your + platform (look for the "ocamlopt" executable), do "make allopt". + + - To generate the documentation, do "make doc" + + - (Optional) To test the library, do "make test". This requires the + installation of OUnit. + + - (Optional) To test the library compiled with ocamlopt and ocamlc, + do "make testall". This requires the installation of OUnit. + + - Become super-user if necessary and do "make install". This + installs the library in the standard Objective Caml library + directory. + +Documentation + + See the HTML documentation in doc/index.html + +References + + libevent:: Files ocaml-event.bak/work/ocaml-event-0.6.0/dllmloevent.so and ocaml-event/work/ocaml-event-0.6.0/dllmloevent.so differ diff -ruN ocaml-event.bak/work/ocaml-event-0.6.0/doc/Liboevent.html ocaml-event/work/ocaml-event-0.6.0/doc/Liboevent.html --- ocaml-event.bak/work/ocaml-event-0.6.0/doc/Liboevent.html 1970-01-01 03:00:00.000000000 +0300 +++ ocaml-event/work/ocaml-event-0.6.0/doc/Liboevent.html 2009-11-29 23:55:32.000000000 +0300 @@ -0,0 +1,141 @@ + + + + + + + + + + + + +Liboevent + + + +

Module Liboevent

+
+
module Liboevent: sig .. end
The Ocaml Event library provides an interface to the event API. +

+ + The event API provides a mechanism to execute a function when a + specific event on a file descriptor occurs or after a given time + has passed. +

+ + This library is a wrapper of the libevent API made by Nils + Provos. For more information about this library see: + http://www.monkey.org/~provos/libevent. +

+ + Currently, libevent supports kqueue(2), select(2), poll(2) and + epoll(4). Support for /dev/poll is planned.
+Author(s): Maas-Maarten Zeeman
+


+
type event 
+
+The type of events
+
+ +
type event_flags = + + + + + + + + + + + + + + + + + + + +
+| +TIMEOUT(*A timeout occurred.*)
+| +READ(*A read is possible.*)
+| +WRITE(*A write operation is possible.*)
+| +SIGNAL(*A signal occurred.*)
+ +
+The possible event types
+
+ +
type event_callback = Unix.file_descr -> event_flags -> unit 
+
+The type of event callbacks
+
+ +
+ +
Basic Libevent Operations

+
val create : unit -> event
+Create a new empty event
+
+
val fd : event -> Unix.file_descr
+fd event returns the file descriptor associated with the event
+
+
val signal : event -> int
+signal event returns the signal associated with the event
+
+
val set : event ->
Unix.file_descr ->
event_flags list ->
persist:bool -> event_callback -> unit
+set event fd type persist callback initializes the event. The + flag persist makes an event persitent until Libevent.del is + called.
+
+
val set_signal : event ->
signal:int -> persist:bool -> event_callback -> unit
+set_signal event signal persist callback initializes the event. The + flag persist makes an event persistent unit Libevent.del is + called.
+
+
val add : event -> float option -> unit
+add event timeout adds the event and schedules the execution + of the function specified with Libevent.set, or in at least the + time specified in the timeout. If timeout is None, no + timeout occures, and the function will only be called if a + matching event occurs on the file descriptor.
+
+
val del : event -> unit
+Del the event
+
+
val pending : event -> event_flags list -> bool

+ +
Process Events

+
val dispatch : unit -> unit
+In order to process events, an application needs to call dispatch. This + * function only returns on error, and should replace the event core of the + * application
+
+
type loop_flags = + + + + + + + + + +
+| +ONCE
+| +NONBLOCK
+ + +
val loop : loop_flags -> unit
+Provides an interface for single pass execution of pending events
+
+ \ No newline at end of file diff -ruN ocaml-event.bak/work/ocaml-event-0.6.0/doc/README ocaml-event/work/ocaml-event-0.6.0/doc/README --- ocaml-event.bak/work/ocaml-event-0.6.0/doc/README 1970-01-01 03:00:00.000000000 +0300 +++ ocaml-event/work/ocaml-event-0.6.0/doc/README 2007-04-20 00:42:39.000000000 +0400 @@ -0,0 +1 @@ +To create the documentation run 'make doc' diff -ruN ocaml-event.bak/work/ocaml-event-0.6.0/doc/index.html ocaml-event/work/ocaml-event-0.6.0/doc/index.html --- ocaml-event.bak/work/ocaml-event-0.6.0/doc/index.html 1970-01-01 03:00:00.000000000 +0300 +++ ocaml-event/work/ocaml-event-0.6.0/doc/index.html 2009-11-29 23:55:32.000000000 +0300 @@ -0,0 +1,25 @@ + + + + + + + + + + + + +

+Index of types
+Index of values
+Index of modules
+

+ + +
Liboevent
+The Ocaml Event library provides an interface to the event API. +
+
+ + \ No newline at end of file diff -ruN ocaml-event.bak/work/ocaml-event-0.6.0/doc/index_attributes.html ocaml-event/work/ocaml-event-0.6.0/doc/index_attributes.html --- ocaml-event.bak/work/ocaml-event-0.6.0/doc/index_attributes.html 1970-01-01 03:00:00.000000000 +0300 +++ ocaml-event/work/ocaml-event-0.6.0/doc/index_attributes.html 2009-11-29 23:55:32.000000000 +0300 @@ -0,0 +1,16 @@ + + + + + + + + +Index of class attributes + + +

Index of class attributes

+ +

+ + \ No newline at end of file diff -ruN ocaml-event.bak/work/ocaml-event-0.6.0/doc/index_class_types.html ocaml-event/work/ocaml-event-0.6.0/doc/index_class_types.html --- ocaml-event.bak/work/ocaml-event-0.6.0/doc/index_class_types.html 1970-01-01 03:00:00.000000000 +0300 +++ ocaml-event/work/ocaml-event-0.6.0/doc/index_class_types.html 2009-11-29 23:55:32.000000000 +0300 @@ -0,0 +1,16 @@ + + + + + + + + +Index of class types + + +

Index of class types

+ +

+ + \ No newline at end of file diff -ruN ocaml-event.bak/work/ocaml-event-0.6.0/doc/index_classes.html ocaml-event/work/ocaml-event-0.6.0/doc/index_classes.html --- ocaml-event.bak/work/ocaml-event-0.6.0/doc/index_classes.html 1970-01-01 03:00:00.000000000 +0300 +++ ocaml-event/work/ocaml-event-0.6.0/doc/index_classes.html 2009-11-29 23:55:32.000000000 +0300 @@ -0,0 +1,16 @@ + + + + + + + + +Index of classes + + +

Index of classes

+ +

+ + \ No newline at end of file diff -ruN ocaml-event.bak/work/ocaml-event-0.6.0/doc/index_exceptions.html ocaml-event/work/ocaml-event-0.6.0/doc/index_exceptions.html --- ocaml-event.bak/work/ocaml-event-0.6.0/doc/index_exceptions.html 1970-01-01 03:00:00.000000000 +0300 +++ ocaml-event/work/ocaml-event-0.6.0/doc/index_exceptions.html 2009-11-29 23:55:32.000000000 +0300 @@ -0,0 +1,16 @@ + + + + + + + + +Index of exceptions + + +

Index of exceptions

+ +

+ + \ No newline at end of file diff -ruN ocaml-event.bak/work/ocaml-event-0.6.0/doc/index_methods.html ocaml-event/work/ocaml-event-0.6.0/doc/index_methods.html --- ocaml-event.bak/work/ocaml-event-0.6.0/doc/index_methods.html 1970-01-01 03:00:00.000000000 +0300 +++ ocaml-event/work/ocaml-event-0.6.0/doc/index_methods.html 2009-11-29 23:55:32.000000000 +0300 @@ -0,0 +1,16 @@ + + + + + + + + +Index of class methods + + +

Index of class methods

+ +

+ + \ No newline at end of file diff -ruN ocaml-event.bak/work/ocaml-event-0.6.0/doc/index_module_types.html ocaml-event/work/ocaml-event-0.6.0/doc/index_module_types.html --- ocaml-event.bak/work/ocaml-event-0.6.0/doc/index_module_types.html 1970-01-01 03:00:00.000000000 +0300 +++ ocaml-event/work/ocaml-event-0.6.0/doc/index_module_types.html 2009-11-29 23:55:32.000000000 +0300 @@ -0,0 +1,16 @@ + + + + + + + + +Index of module types + + +

Index of module types

+ +

+ + \ No newline at end of file diff -ruN ocaml-event.bak/work/ocaml-event-0.6.0/doc/index_modules.html ocaml-event/work/ocaml-event-0.6.0/doc/index_modules.html --- ocaml-event.bak/work/ocaml-event-0.6.0/doc/index_modules.html 1970-01-01 03:00:00.000000000 +0300 +++ ocaml-event/work/ocaml-event-0.6.0/doc/index_modules.html 2009-11-29 23:55:32.000000000 +0300 @@ -0,0 +1,22 @@ + + + + + + + + +Index of modules + + +

Index of modules

+ + + + +

L
Liboevent
+The Ocaml Event library provides an interface to the event API. +
+

+ + \ No newline at end of file diff -ruN ocaml-event.bak/work/ocaml-event-0.6.0/doc/index_types.html ocaml-event/work/ocaml-event-0.6.0/doc/index_types.html --- ocaml-event.bak/work/ocaml-event-0.6.0/doc/index_types.html 1970-01-01 03:00:00.000000000 +0300 +++ ocaml-event/work/ocaml-event-0.6.0/doc/index_types.html 2009-11-29 23:55:32.000000000 +0300 @@ -0,0 +1,35 @@ + + + + + + + + +Index of types + + +

Index of types

+ + + + + + + + + + + +

E
event [Liboevent]
+The type of events +
+
event_callback [Liboevent]
+The type of event callbacks +
+
event_flags [Liboevent]
+The possible event types +
+

L
loop_flags [Liboevent]

+ + \ No newline at end of file diff -ruN ocaml-event.bak/work/ocaml-event-0.6.0/doc/index_values.html ocaml-event/work/ocaml-event-0.6.0/doc/index_values.html --- ocaml-event.bak/work/ocaml-event-0.6.0/doc/index_values.html 1970-01-01 03:00:00.000000000 +0300 +++ ocaml-event/work/ocaml-event-0.6.0/doc/index_values.html 2009-11-29 23:55:32.000000000 +0300 @@ -0,0 +1,72 @@ + + + + + + + + +Index of values + + +

Index of values

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +

A
add [Liboevent]
+add event timeout adds the event and schedules the execution + of the function specified with Libevent.set, or in at least the + time specified in the timeout. +
+

C
create [Liboevent]
+Create a new empty event +
+

D
del [Liboevent]
+Del the event +
+
dispatch [Liboevent]
+In order to process events, an application needs to call dispatch. +
+

F
fd [Liboevent]
+fd event returns the file descriptor associated with the event +
+

L
loop [Liboevent]
+Provides an interface for single pass execution of pending events +
+

P
pending [Liboevent]

S
set [Liboevent]
+set event fd type persist callback initializes the event. +
+
set_signal [Liboevent]
+set_signal event signal persist callback initializes the event. +
+
signal [Liboevent]
+signal event returns the signal associated with the event +
+

+ + \ No newline at end of file diff -ruN ocaml-event.bak/work/ocaml-event-0.6.0/doc/style.css ocaml-event/work/ocaml-event-0.6.0/doc/style.css --- ocaml-event.bak/work/ocaml-event-0.6.0/doc/style.css 1970-01-01 03:00:00.000000000 +0300 +++ ocaml-event/work/ocaml-event-0.6.0/doc/style.css 2009-11-29 23:55:32.000000000 +0300 @@ -0,0 +1,33 @@ +a:visited {color : #416DFF; text-decoration : none; } +a:link {color : #416DFF; text-decoration : none;} +a:hover {color : Red; text-decoration : none; background-color: #5FFF88} +a:active {color : Red; text-decoration : underline; } +.keyword { font-weight : bold ; color : Red } +.keywordsign { color : #C04600 } +.superscript { font-size : 4 } +.subscript { font-size : 4 } +.comment { color : Green } +.constructor { color : Blue } +.type { color : #5C6585 } +.string { color : Maroon } +.warning { color : Red ; font-weight : bold } +.info { margin-left : 3em; margin-right : 3em } +.param_info { margin-top: 4px; margin-left : 3em; margin-right : 3em } +.code { color : #465F91 ; } +h1 { font-size : 20pt ; text-align: center; } +h2 { font-size : 20pt ; border: 1px solid #000000; margin-top: 5px; margin-bottom: 2px;text-align: center; background-color: #90BDFF ;padding: 2px; } +h3 { font-size : 20pt ; border: 1px solid #000000; margin-top: 5px; margin-bottom: 2px;text-align: center; background-color: #90DDFF ;padding: 2px; } +h4 { font-size : 20pt ; border: 1px solid #000000; margin-top: 5px; margin-bottom: 2px;text-align: center; background-color: #90EDFF ;padding: 2px; } +h5 { font-size : 20pt ; border: 1px solid #000000; margin-top: 5px; margin-bottom: 2px;text-align: center; background-color: #90FDFF ;padding: 2px; } +h6 { font-size : 20pt ; border: 1px solid #000000; margin-top: 5px; margin-bottom: 2px;text-align: center; background-color: #C0FFFF ; padding: 2px; } +div.h7 { font-size : 20pt ; border: 1px solid #000000; margin-top: 5px; margin-bottom: 2px;text-align: center; background-color: #E0FFFF ; padding: 2px; } +div.h8 { font-size : 20pt ; border: 1px solid #000000; margin-top: 5px; margin-bottom: 2px;text-align: center; background-color: #F0FFFF ; padding: 2px; } +div.h9 { font-size : 20pt ; border: 1px solid #000000; margin-top: 5px; margin-bottom: 2px;text-align: center; background-color: #FFFFFF ; padding: 2px; } +.typetable { border-style : hidden } +.indextable { border-style : hidden } +.paramstable { border-style : hidden ; padding: 5pt 5pt} +body { background-color : White } +tr { background-color : White } +td.typefieldcomment { background-color : #FFFFFF ; font-size: smaller ;} +pre { margin-bottom: 4px } +div.sig_block {margin-left: 2em} \ No newline at end of file diff -ruN ocaml-event.bak/work/ocaml-event-0.6.0/doc/type_Liboevent.html ocaml-event/work/ocaml-event-0.6.0/doc/type_Liboevent.html --- ocaml-event.bak/work/ocaml-event-0.6.0/doc/type_Liboevent.html 1970-01-01 03:00:00.000000000 +0300 +++ ocaml-event/work/ocaml-event-0.6.0/doc/type_Liboevent.html 2009-11-29 23:55:32.000000000 +0300 @@ -0,0 +1,32 @@ + + + + + + + +Liboevent + + +sig
+  type event
+  type event_flags = TIMEOUT | READ | WRITE | SIGNAL
+  type event_callback = Unix.file_descr -> Liboevent.event_flags -> unit
+  val create : unit -> Liboevent.event
+  val fd : Liboevent.event -> Unix.file_descr
+  val signal : Liboevent.event -> int
+  val set :
+    Liboevent.event ->
+    Unix.file_descr ->
+    Liboevent.event_flags list ->
+    persist:bool -> Liboevent.event_callback -> unit
+  val set_signal :
+    Liboevent.event ->
+    signal:int -> persist:bool -> Liboevent.event_callback -> unit
+  val add : Liboevent.event -> float option -> unit
+  val del : Liboevent.event -> unit
+  val pending : Liboevent.event -> Liboevent.event_flags list -> bool
+  val dispatch : unit -> unit
+  type loop_flags = ONCE | NONBLOCK
+  val loop : Liboevent.loop_flags -> unit
+end
\ No newline at end of file diff -ruN ocaml-event.bak/work/ocaml-event-0.6.0/event_stubs.c ocaml-event/work/ocaml-event-0.6.0/event_stubs.c --- ocaml-event.bak/work/ocaml-event-0.6.0/event_stubs.c 1970-01-01 03:00:00.000000000 +0300 +++ ocaml-event/work/ocaml-event-0.6.0/event_stubs.c 2009-11-26 11:41:10.000000000 +0300 @@ -0,0 +1,223 @@ +/************************************************************************/ +/* The OcamlEvent library */ +/* */ +/* Copyright 2002, 2003, 2004 Maas-Maarten Zeeman. All rights reserved. */ +/* See LICENCE for details. */ +/************************************************************************/ + +/* $Id: event_stubs.c,v 1.2 2009-11-26 08:41:10 maas Exp $ */ + +/* Stub code to interface Ocaml with libevent */ + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#define struct_event_val(v) (*(struct event**) Data_custom_val(v)) +#define Is_some(v) (Is_block(v)) + +static value * event_cb_closure = NULL; + +/* use the error function from the Unix library */ +extern void uerror (char * cmdname, value arg) Noreturn; + +static void +struct_event_finalize(value ve) +{ + struct event *ev = struct_event_val(ve); + + if (event_initialized(ev)) { + event_del(ev); + } + + stat_free(struct_event_val(ve)); +} + +static int +struct_event_compare(value v1, value v2) +{ + struct event *p1 = struct_event_val(v1); + struct event *p2 = struct_event_val(v2); + if(p1 == p2) return 0; + if(p1 < p2) return -1; + return 1; +} + +static long +struct_event_hash(value v) +{ + return (long) struct_event_val(v); +} + +static struct custom_operations struct_event_ops = { + "struct event", + struct_event_finalize, + struct_event_compare, + struct_event_hash, + custom_serialize_default, + custom_deserialize_default +}; + +/* + * This callback calls the ocaml event callback, which will in turn + * call the real ocaml callback. + */ +static void +event_cb(int fd, short type, void *arg) +{ + callback3(*event_cb_closure, + Val_long((long) arg), Val_int(fd), Val_int(type)); +} + +static void +set_struct_timeval(struct timeval *tv, value vfloat) +{ + double timeout = Double_val(vfloat); + tv->tv_sec = (int) timeout; + tv->tv_usec = (int) (1e6 * (timeout - tv->tv_sec)); +} + +CAMLprim value +oc_create_event(value unit) +{ + CAMLparam0(); + CAMLlocal1(ve); + struct event* ev = caml_stat_alloc(sizeof(struct event)); + memset(ev, 0, sizeof(*ev)); + + ve = alloc_custom(&struct_event_ops, sizeof(struct event*), 0, 1); + *(struct event**) Data_custom_val(ve) = ev; + + CAMLreturn(ve); +} + +CAMLprim value +oc_event_id(value vevent) +{ + CAMLparam0(); + CAMLreturn(Val_long((long) struct_event_val(vevent))); +} + +CAMLprim value +oc_event_fd(value vevent) +{ + CAMLparam1(vevent); + CAMLreturn(Val_long(EVENT_FD(struct_event_val(vevent)))); +} + +CAMLprim value +oc_event_set(value vevent, value fd, value vevent_flag) +{ + CAMLparam3(vevent, fd, vevent_flag); + + struct event *event = struct_event_val(vevent); + + event_set(event, Int_val(fd), Int_val(vevent_flag), + &event_cb, event); + + CAMLreturn(Val_unit); +} + +CAMLprim value +oc_event_add(value vevent, value vfloat_option) +{ + CAMLparam2(vevent, vfloat_option); + struct event *event = struct_event_val(vevent); + struct timeval timeval; + struct timeval *tv = NULL; + + if Is_some(vfloat_option) { + set_struct_timeval(&timeval, Field(vfloat_option, 0)); + tv = &timeval; + } + + if((0 != event_add(event, tv))) { + uerror("event_add", vevent); + } + + CAMLreturn(Val_unit); +} + +CAMLprim value +oc_event_del(value vevent) +{ + CAMLparam0(); + struct event *event = struct_event_val(vevent); + + event_del(event); + + CAMLreturn(Val_unit); +} + +CAMLprim value +oc_event_pending(value vevent, value vtype, value vfloat_option) +{ + CAMLparam3(vevent, vtype, vfloat_option); + struct event *event = struct_event_val(vevent); + struct timeval timeval; + struct timeval *tv = NULL; + + if Is_some(vfloat_option) { + set_struct_timeval(&timeval, Field(vfloat_option, 0)); + tv = &timeval; + } + + event_pending(event, Int_val(vtype), tv); + + CAMLreturn(Val_unit); +} + +CAMLprim value +oc_event_loop(value vloop_flag) +{ + CAMLparam1(vloop_flag); + + if((-1 == event_loop(Int_val(vloop_flag)))) { + uerror("event_dispatch", vloop_flag); + } + + CAMLreturn(Val_unit); +} + + +CAMLprim value +oc_event_dispatch(value unit) +{ + CAMLparam1(unit); + + if((-1 == event_dispatch())) { + uerror("event_dispatch", unit); + } + + CAMLreturn(Val_unit); +} + +/* + * Initialize the event library + */ +CAMLprim value +oc_event_init(value unit) +{ + CAMLparam1(unit); + + /* setup the event callback closure if needed */ + if(event_cb_closure == NULL) { + event_cb_closure = caml_named_value("event_cb"); + if(event_cb_closure == NULL) { + invalid_argument("Callback event_cv not initialized."); + } + } + + /* and don't forget to initialize libevent */ + event_init(); + + CAMLreturn(Val_unit); +} Files ocaml-event.bak/work/ocaml-event-0.6.0/event_stubs.o and ocaml-event/work/ocaml-event-0.6.0/event_stubs.o differ diff -ruN ocaml-event.bak/work/ocaml-event-0.6.0/examples/Makefile ocaml-event/work/ocaml-event-0.6.0/examples/Makefile --- ocaml-event.bak/work/ocaml-event-0.6.0/examples/Makefile 1970-01-01 03:00:00.000000000 +0300 +++ ocaml-event/work/ocaml-event-0.6.0/examples/Makefile 2007-04-20 00:42:39.000000000 +0400 @@ -0,0 +1,23 @@ +# +# Simple makefile to build the example programs. The event library +# must be installed first. +# + +all: fifo_example signal_example http_server + +fifo_example: fifo_example.ml + ocamlfind ocamlc -o fifo_example -package libevent -linkpkg \ + fifo_example.ml + +signal_example: signal_example.ml + ocamlfind ocamlc -o signal_example -package libevent -linkpkg \ + signal_example.ml + +http_server: http_server.ml + ocamlfind ocamlc -o http_server -package libevent -linkpkg \ + http_server.ml + +.PHONY: clean +clean:: + rm -f *~ *.cm* *.o fifo_example signal_example http_server + diff -ruN ocaml-event.bak/work/ocaml-event-0.6.0/examples/fifo_example.ml ocaml-event/work/ocaml-event-0.6.0/examples/fifo_example.ml --- ocaml-event.bak/work/ocaml-event-0.6.0/examples/fifo_example.ml 1970-01-01 03:00:00.000000000 +0300 +++ ocaml-event/work/ocaml-event-0.6.0/examples/fifo_example.ml 2007-04-20 00:42:39.000000000 +0400 @@ -0,0 +1,38 @@ +(* + * Small example program + *) + +open Libevent + +let fifo_read event fd event_type = + let buflen = 255 in + let buf = String.create buflen in + match Unix.read fd buf 0 buflen with + 0 -> + Printf.printf "Connection closed\n"; + flush stdout + | n -> + Printf.printf "Read: %s\n" (String.sub buf 0 n); + flush stdout; + + (* Reschedule this event *) + add event None + +let _ = + let fifo = "event.fifo" in + + Unix.unlink fifo; + Unix.mkfifo fifo 0o600; + + let fifo_fd = Unix.openfile fifo [ Unix.O_RDWR; Unix.O_NONBLOCK ] 0 in + let evfifo = create () in + + Printf.printf "Write date to: %s\n" fifo; + flush stdout; + + set evfifo fifo_fd [READ] false (fifo_read evfifo); + add evfifo None; + + dispatch () + + diff -ruN ocaml-event.bak/work/ocaml-event-0.6.0/examples/http_server.ml ocaml-event/work/ocaml-event-0.6.0/examples/http_server.ml --- ocaml-event.bak/work/ocaml-event-0.6.0/examples/http_server.ml 1970-01-01 03:00:00.000000000 +0300 +++ ocaml-event/work/ocaml-event-0.6.0/examples/http_server.ml 2007-04-20 00:42:39.000000000 +0400 @@ -0,0 +1,64 @@ +(* + * Simple but fast HTTP Server + *) + +let accept fd = + let client_fd, client_addr = Unix.accept fd in + Unix.set_nonblock client_fd; + client_fd, client_addr + +let http_server_cb buffer buflen fd event_type = + let client_fd, client_addr = accept fd in + + let read_event = Libevent.create () in + let write_event = Libevent.create () in + + (* The http connection callback *) + let http_read_cb fd event_type = + let len = Unix.read fd buffer 0 buflen in + + (* HTTP Request not parsed, does not even have to be complete yet.*) + let http_write_cb fd event_type = + let response = "HTTP/1.0 200 OK\n\r" ^ + "Server: Caml 1.0\r\n" ^ + "\r\n" ^ + "

Hi There

" ^ + "
" ^ (String.sub buffer 0 len) ^ "
" ^ + " 0x01 + | READ -> 0x02 + | WRITE -> 0x04 + | SIGNAL -> 0x08 + +let event_type_of_int = function + | 1 -> TIMEOUT + | 2 -> READ + | 4 -> WRITE + | 8 -> SIGNAL + | _ -> raise (Invalid_argument "event_type") + +type event_callback = Unix.file_descr -> event_flags -> unit + +(* Use an internal hashtable to store the ocaml callbacks with the + event *) +let table = Hashtbl.create 0 + +(* Called by the c-stub, locate, and call the ocaml callback *) +let event_cb event_id fd etype = + (Hashtbl.find table event_id) fd (event_type_of_int etype) + +(* Create an event *) +external create : unit -> event = "oc_create_event" + +(* Return the id of an event *) +external event_id : event -> int = "oc_event_id" + +(* Return the signal associated with the event *) +external signal : event -> int = "oc_event_fd" + +(* Return the fd associated with the event *) +external fd : event -> Unix.file_descr = "oc_event_fd" + +(* Set an event (not exported) *) +external cset_fd : event -> Unix.file_descr -> int -> unit = "oc_event_set" +external cset_int : event -> int -> int -> unit = "oc_event_set" + +(* Event set *) +let set event fd etype persist (cb : event_callback) = + let rec int_of_event_type_list flag = function + h::t -> int_of_event_type_list (flag lor (int_of_event_type h)) t + | [] -> flag + in + let flag = + let f = int_of_event_type_list 0 etype in + if persist then + f lor 0x10 + else + f + in + Hashtbl.add table (event_id event) cb; + cset_fd event fd flag + +let set_signal event signal persist (cb : event_callback) = + let signal_flag = (int_of_event_type SIGNAL) in + let flag = if persist then + signal_flag lor 0x10 + else + signal_flag + in + Hashtbl.add table (event_id event) cb; + cset_int event signal flag + +(* Add an event *) +external add : event -> float option -> unit = "oc_event_add" + +(* Del an event *) +external cdel : event -> unit = "oc_event_del" +let del event = + Hashtbl.remove table (event_id event); + cdel event + +(* *) +(* Not fully implemented yet *) +external pending : event -> event_flags list -> bool = "oc_event_pending" + +(* Process events *) +external dispatch : unit -> unit = "oc_event_dispatch" + +type loop_flags = ONCE | NONBLOCK +external loop : loop_flags -> unit = "oc_event_loop" + +(* Initialize the event library *) +external init : unit -> unit = "oc_event_init" +let _ = + Callback.register "event_cb" event_cb; + init () + + + diff -ruN ocaml-event.bak/work/ocaml-event-0.6.0/liboevent.mli ocaml-event/work/ocaml-event-0.6.0/liboevent.mli --- ocaml-event.bak/work/ocaml-event-0.6.0/liboevent.mli 1970-01-01 03:00:00.000000000 +0300 +++ ocaml-event/work/ocaml-event-0.6.0/liboevent.mli 2009-11-26 11:59:15.000000000 +0300 @@ -0,0 +1,88 @@ +(***********************************************************************) +(* The Ocaml Libevent library *) +(* *) +(* Copyright 2002, 2003, 2004 Maas-Maarten Zeeman. All rights *) +(* reserved. See LICENCE for details. *) +(***********************************************************************) + + +(** The Ocaml Event library provides an interface to the event API. + + The event API provides a mechanism to execute a function when a + specific event on a file descriptor occurs or after a given time + has passed. + + This library is a wrapper of the libevent API made by Nils + Provos. For more information about this library see: + http://www.monkey.org/~provos/libevent. + + Currently, libevent supports kqueue(2), select(2), poll(2) and + epoll(4). Support for /dev/poll is planned. + + @author Maas-Maarten Zeeman +*) + +(** The type of events *) +type event + +(** The possible event types *) +type event_flags = + TIMEOUT (** A timeout occurred. *) + | READ (** A read is possible. *) + | WRITE (** A write operation is possible. *) + | SIGNAL (** A signal occurred. *) + +type event_callback = Unix.file_descr -> event_flags -> unit +(** The type of event callbacks *) + +(** {5 Basic Libevent Operations} *) + +val create : unit -> event +(** Create a new empty event *) + +val fd : event -> Unix.file_descr +(** [fd event] returns the file descriptor associated with the event *) + +val signal : event -> int +(** [signal event] returns the signal associated with the event *) + +val set : event -> + Unix.file_descr -> event_flags list -> persist:bool -> event_callback -> unit +(** [set event fd type persist callback] initializes the event. The + flag [persist] makes an event persitent until {!Libevent.del} is + called. *) + +val set_signal : event -> + signal:int -> persist:bool -> event_callback -> unit +(** [set_signal event signal persist callback] initializes the event. The + flag [persist] makes an event persistent unit {!Libevent.del} is + called. *) + +val add : event -> float option -> unit +(** [add event timeout] adds the [event] and schedules the execution + of the function specified with {!Libevent.set}, or in at least the + time specified in the [timeout]. If [timeout] is [None], no + timeout occures, and the function will only be called if a + matching event occurs on the file descriptor. *) + +val del : event -> unit +(** Del the event *) + +val pending : event -> event_flags list -> bool + +(** {5 Process Events} *) + +val dispatch : unit -> unit +(** In order to process events, an application needs to call dispatch. This + * function only returns on error, and should replace the event core of the + * application + *) + +type loop_flags = + ONCE + | NONBLOCK +val loop : loop_flags -> unit +(** Provides an interface for single pass execution of pending events *) + + + Files ocaml-event.bak/work/ocaml-event-0.6.0/liboevent.o and ocaml-event/work/ocaml-event-0.6.0/liboevent.o differ diff -ruN ocaml-event.bak/work/ocaml-event-0.6.0/unittest.ml ocaml-event/work/ocaml-event-0.6.0/unittest.ml --- ocaml-event.bak/work/ocaml-event-0.6.0/unittest.ml 1970-01-01 03:00:00.000000000 +0300 +++ ocaml-event/work/ocaml-event-0.6.0/unittest.ml 2009-11-26 12:10:37.000000000 +0300 @@ -0,0 +1,80 @@ +(***********************************************************************) +(* The OcamlEvent library *) +(* *) +(* Copyright 2002, 2003 Maas-Maarten Zeeman. All rights reserved. See *) +(* LICENCE for details. *) +(***********************************************************************) + +(* $Id: unittest.ml,v 1.3 2009-11-26 09:10:37 maas Exp $ *) + +open OUnit + +let create_event = Liboevent.create + +(* Tests the creation of new events *) +let test_create_event _ = + let e1 = create_event () in + let e2 = create_event () in + "Events should be different" @? (e1 <> e2) + +(* Tests if pending can be called with and without the optional float *) +let test_pending _ = + let e = create_event () in + ignore(Liboevent.pending e []) + +(* Test eof on a read callback *) +let test_read_eof _ = + let test_string = "This is a test string\n\n\n" in + let buflen = 512 in + let buf = String.create buflen in + let read_count = ref 0 in + let evt = create_event () in + let read_cb fd event_type = + (* read data from the fd *) + let len = Unix.read fd buf 0 buflen in + (* when 0 bytes are read this is the EOF, and we are done. *) + if len <> 0 then + begin + read_count := !read_count + len; + Liboevent.add evt None + end + in + + (* Create a socket pair for testing *) + let s1, s2 = Unix.socketpair Unix.PF_UNIX Unix.SOCK_STREAM 0 in + let _ = Unix.write s1 test_string 0 (String.length test_string) in + + (* A shutdown_send will cause an EOF on the reading end *) + Unix.shutdown s1 Unix.SHUTDOWN_SEND; + + (* Setup the event *) + Liboevent.set evt s2 [Liboevent.READ] false read_cb; + Liboevent.add evt None; + Liboevent.dispatch (); + + (* Now its time to check some things *) + assert_equal (String.length test_string) ! read_count + +(* This is not really a test (yet) *) +let call_set _ = + let do_nothing _ _ = + () + in + let e1 = Liboevent.create () in + Liboevent.set e1 Unix.stderr [Liboevent.WRITE] false do_nothing; + Liboevent.set e1 Unix.stdout [Liboevent.WRITE] false do_nothing; + Liboevent.set e1 Unix.stdin [Liboevent.READ] false do_nothing; + Liboevent.add e1 (Some 0.1); + Liboevent.loop(Liboevent.ONCE) + +(* Construct the test suite *) +let suite = "event" >::: + ["create_event" >:: test_create_event; + "test_pending" >:: test_pending; + "test_read_eof" >:: test_read_eof; + "call_set" >:: call_set; + ] + +(* Run the tests in the test suite *) +let _ = + run_test_tt_main suite >Release-Note: >Audit-Trail: >Unformatted: