Date: Sun, 29 Nov 2009 21:07:08 GMT From: soulcatcher <soulcatcher13@gmail.com> To: freebsd-gnats-submit@FreeBSD.org Subject: ports/141006: [patch] devel/ocaml-event: update to 0.6.0 Message-ID: <200911292107.nATL784l057363@www.freebsd.org> Resent-Message-ID: <200911292110.nATLA17P081774@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>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::<http://www.monkey.org/~provos/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 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html> +<head> +<link rel="stylesheet" href="style.css" type="text/css"> +<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type"> +<link rel="Start" href="index.html"> +<link rel="Up" href="index.html"> +<link title="Index of types" rel=Appendix href="index_types.html"> +<link title="Index of values" rel=Appendix href="index_values.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Liboevent" rel="Chapter" href="Liboevent.html"><link title="Basic Libevent Operations" rel="Section" href="#5_BasicLibeventOperations"> +<link title="Process Events" rel="Section" href="#5_ProcessEvents"> +<title>Liboevent</title> +</head> +<body> +<div class="navbar"> <a href="index.html">Up</a> + </div> +<center><h1>Module <a href="type_Liboevent.html">Liboevent</a></h1></center> +<br> +<pre><span class="keyword">module</span> Liboevent: <code class="code">sig</code> <a href="Liboevent.html">..</a> <code class="code">end</code></pre>The Ocaml Event library provides an interface to the event API. +<p> + + 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. +<p> + + 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. +<p> + + Currently, libevent supports kqueue(2), select(2), poll(2) and + epoll(4). Support for /dev/poll is planned.<br> +<b>Author(s):</b> Maas-Maarten Zeeman<br> +<hr width="100%"> +<pre><span class="keyword">type</span> <a name="TYPEevent"></a><code class="type"></code>event </pre> +<div class="info"> +The type of events<br> +</div> + +<br><code><span class="keyword">type</span> <a name="TYPEevent_flags"></a><code class="type"></code>event_flags = </code><table class="typetable"> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">TIMEOUT</span></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" >A timeout occurred.</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">READ</span></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" >A read is possible.</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">WRITE</span></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" >A write operation is possible.</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">SIGNAL</span></code></td> +<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" >A signal occurred.</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> +</tr></table> + +<div class="info"> +The possible event types<br> +</div> + +<pre><span class="keyword">type</span> <a name="TYPEevent_callback"></a><code class="type"></code>event_callback = <code class="type">Unix.file_descr -> <a href="Liboevent.html#TYPEevent_flags">event_flags</a> -> unit</code> </pre> +<div class="info"> +The type of event callbacks<br> +</div> + +<br> +<a name="5_BasicLibeventOperations"></a> +<h5>Basic Libevent Operations</h5><br> +<pre><span class="keyword">val</span> <a name="VALcreate"></a>create : <code class="type">unit -> <a href="Liboevent.html#TYPEevent">event</a></code></pre><div class="info"> +Create a new empty event<br> +</div> +<pre><span class="keyword">val</span> <a name="VALfd"></a>fd : <code class="type"><a href="Liboevent.html#TYPEevent">event</a> -> Unix.file_descr</code></pre><div class="info"> +<code class="code">fd event</code> returns the file descriptor associated with the event<br> +</div> +<pre><span class="keyword">val</span> <a name="VALsignal"></a>signal : <code class="type"><a href="Liboevent.html#TYPEevent">event</a> -> int</code></pre><div class="info"> +<code class="code">signal event</code> returns the signal associated with the event<br> +</div> +<pre><span class="keyword">val</span> <a name="VALset"></a>set : <code class="type"><a href="Liboevent.html#TYPEevent">event</a> -><br> Unix.file_descr -><br> <a href="Liboevent.html#TYPEevent_flags">event_flags</a> list -><br> persist:bool -> <a href="Liboevent.html#TYPEevent_callback">event_callback</a> -> unit</code></pre><div class="info"> +<code class="code">set event fd type persist callback</code> initializes the event. The + flag <code class="code">persist</code> makes an event persitent until <code class="code">Libevent.del</code> is + called.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALset_signal"></a>set_signal : <code class="type"><a href="Liboevent.html#TYPEevent">event</a> -><br> signal:int -> persist:bool -> <a href="Liboevent.html#TYPEevent_callback">event_callback</a> -> unit</code></pre><div class="info"> +<code class="code">set_signal event signal persist callback</code> initializes the event. The + flag <code class="code">persist</code> makes an event persistent unit <code class="code">Libevent.del</code> is + called.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALadd"></a>add : <code class="type"><a href="Liboevent.html#TYPEevent">event</a> -> float option -> unit</code></pre><div class="info"> +<code class="code">add event timeout</code> adds the <code class="code">event</code> and schedules the execution + of the function specified with <code class="code">Libevent.set</code>, or in at least the + time specified in the <code class="code">timeout</code>. If <code class="code">timeout</code> is <code class="code">None</code>, no + timeout occures, and the function will only be called if a + matching event occurs on the file descriptor.<br> +</div> +<pre><span class="keyword">val</span> <a name="VALdel"></a>del : <code class="type"><a href="Liboevent.html#TYPEevent">event</a> -> unit</code></pre><div class="info"> +Del the event<br> +</div> +<pre><span class="keyword">val</span> <a name="VALpending"></a>pending : <code class="type"><a href="Liboevent.html#TYPEevent">event</a> -> <a href="Liboevent.html#TYPEevent_flags">event_flags</a> list -> bool</code></pre><br> +<a name="5_ProcessEvents"></a> +<h5>Process Events</h5><br> +<pre><span class="keyword">val</span> <a name="VALdispatch"></a>dispatch : <code class="type">unit -> unit</code></pre><div class="info"> +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<br> +</div> +<br><code><span class="keyword">type</span> <a name="TYPEloop_flags"></a><code class="type"></code>loop_flags = </code><table class="typetable"> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">ONCE</span></code></td> + +</tr> +<tr> +<td align="left" valign="top" > +<code><span class="keyword">|</span></code></td> +<td align="left" valign="top" > +<code><span class="constructor">NONBLOCK</span></code></td> + +</tr></table> + + +<pre><span class="keyword">val</span> <a name="VALloop"></a>loop : <code class="type"><a href="Liboevent.html#TYPEloop_flags">loop_flags</a> -> unit</code></pre><div class="info"> +Provides an interface for single pass execution of pending events<br> +</div> +</body></html> \ 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 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html> +<head> +<link rel="stylesheet" href="style.css" type="text/css"> +<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type"> +<link rel="Start" href="index.html"> +<link title="Index of types" rel=Appendix href="index_types.html"> +<link title="Index of values" rel=Appendix href="index_values.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Liboevent" rel="Chapter" href="Liboevent.html"><title></title> +</head> +<body> +<center><h1></h1></center> +<a href="index_types.html">Index of types</a><br> +<a href="index_values.html">Index of values</a><br> +<a href="index_modules.html">Index of modules</a><br> +<br/><br> +<table class="indextable"> +<tr><td><a href="Liboevent.html">Liboevent</a></td><td><div class="info"> +The Ocaml Event library provides an interface to the event API. +</div> +</td></tr> +</table> +</body> +</html> \ 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 @@ +<html> +<head> +<link rel="stylesheet" href="style.css" type="text/css"> +<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type"> +<link rel="Start" href="index.html"> +<link title="Index of types" rel=Appendix href="index_types.html"> +<link title="Index of values" rel=Appendix href="index_values.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Liboevent" rel="Chapter" href="Liboevent.html"><title>Index of class attributes</title> +</head> +<body> +<center><h1>Index of class attributes</h1></center> +<table> +</table><br> +</body> +</html> \ 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 @@ +<html> +<head> +<link rel="stylesheet" href="style.css" type="text/css"> +<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type"> +<link rel="Start" href="index.html"> +<link title="Index of types" rel=Appendix href="index_types.html"> +<link title="Index of values" rel=Appendix href="index_values.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Liboevent" rel="Chapter" href="Liboevent.html"><title>Index of class types</title> +</head> +<body> +<center><h1>Index of class types</h1></center> +<table> +</table><br> +</body> +</html> \ 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 @@ +<html> +<head> +<link rel="stylesheet" href="style.css" type="text/css"> +<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type"> +<link rel="Start" href="index.html"> +<link title="Index of types" rel=Appendix href="index_types.html"> +<link title="Index of values" rel=Appendix href="index_values.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Liboevent" rel="Chapter" href="Liboevent.html"><title>Index of classes</title> +</head> +<body> +<center><h1>Index of classes</h1></center> +<table> +</table><br> +</body> +</html> \ 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 @@ +<html> +<head> +<link rel="stylesheet" href="style.css" type="text/css"> +<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type"> +<link rel="Start" href="index.html"> +<link title="Index of types" rel=Appendix href="index_types.html"> +<link title="Index of values" rel=Appendix href="index_values.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Liboevent" rel="Chapter" href="Liboevent.html"><title>Index of exceptions</title> +</head> +<body> +<center><h1>Index of exceptions</h1></center> +<table> +</table><br> +</body> +</html> \ 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 @@ +<html> +<head> +<link rel="stylesheet" href="style.css" type="text/css"> +<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type"> +<link rel="Start" href="index.html"> +<link title="Index of types" rel=Appendix href="index_types.html"> +<link title="Index of values" rel=Appendix href="index_values.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Liboevent" rel="Chapter" href="Liboevent.html"><title>Index of class methods</title> +</head> +<body> +<center><h1>Index of class methods</h1></center> +<table> +</table><br> +</body> +</html> \ 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 @@ +<html> +<head> +<link rel="stylesheet" href="style.css" type="text/css"> +<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type"> +<link rel="Start" href="index.html"> +<link title="Index of types" rel=Appendix href="index_types.html"> +<link title="Index of values" rel=Appendix href="index_values.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Liboevent" rel="Chapter" href="Liboevent.html"><title>Index of module types</title> +</head> +<body> +<center><h1>Index of module types</h1></center> +<table> +</table><br> +</body> +</html> \ 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 @@ +<html> +<head> +<link rel="stylesheet" href="style.css" type="text/css"> +<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type"> +<link rel="Start" href="index.html"> +<link title="Index of types" rel=Appendix href="index_types.html"> +<link title="Index of values" rel=Appendix href="index_values.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Liboevent" rel="Chapter" href="Liboevent.html"><title>Index of modules</title> +</head> +<body> +<center><h1>Index of modules</h1></center> +<table> +<tr><td align="left"><br>L</td></tr> +<tr><td><a href="Liboevent.html">Liboevent</a> </td> +<td><div class="info"> +The Ocaml Event library provides an interface to the event API. +</div> +</td></tr> +</table><br> +</body> +</html> \ 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 @@ +<html> +<head> +<link rel="stylesheet" href="style.css" type="text/css"> +<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type"> +<link rel="Start" href="index.html"> +<link title="Index of types" rel=Appendix href="index_types.html"> +<link title="Index of values" rel=Appendix href="index_values.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Liboevent" rel="Chapter" href="Liboevent.html"><title>Index of types</title> +</head> +<body> +<center><h1>Index of types</h1></center> +<table> +<tr><td align="left"><br>E</td></tr> +<tr><td><a href="Liboevent.html#TYPEevent">event</a> [<a href="Liboevent.html">Liboevent</a>]</td> +<td><div class="info"> +The type of events +</div> +</td></tr> +<tr><td><a href="Liboevent.html#TYPEevent_callback">event_callback</a> [<a href="Liboevent.html">Liboevent</a>]</td> +<td><div class="info"> +The type of event callbacks +</div> +</td></tr> +<tr><td><a href="Liboevent.html#TYPEevent_flags">event_flags</a> [<a href="Liboevent.html">Liboevent</a>]</td> +<td><div class="info"> +The possible event types +</div> +</td></tr> +<tr><td align="left"><br>L</td></tr> +<tr><td><a href="Liboevent.html#TYPEloop_flags">loop_flags</a> [<a href="Liboevent.html">Liboevent</a>]</td> +<td></td></tr> +</table><br> +</body> +</html> \ 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 @@ +<html> +<head> +<link rel="stylesheet" href="style.css" type="text/css"> +<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type"> +<link rel="Start" href="index.html"> +<link title="Index of types" rel=Appendix href="index_types.html"> +<link title="Index of values" rel=Appendix href="index_values.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Liboevent" rel="Chapter" href="Liboevent.html"><title>Index of values</title> +</head> +<body> +<center><h1>Index of values</h1></center> +<table> +<tr><td align="left"><br>A</td></tr> +<tr><td><a href="Liboevent.html#VALadd">add</a> [<a href="Liboevent.html">Liboevent</a>]</td> +<td><div class="info"> +<code class="code">add event timeout</code> adds the <code class="code">event</code> and schedules the execution + of the function specified with <code class="code">Libevent.set</code>, or in at least the + time specified in the <code class="code">timeout</code>. +</div> +</td></tr> +<tr><td align="left"><br>C</td></tr> +<tr><td><a href="Liboevent.html#VALcreate">create</a> [<a href="Liboevent.html">Liboevent</a>]</td> +<td><div class="info"> +Create a new empty event +</div> +</td></tr> +<tr><td align="left"><br>D</td></tr> +<tr><td><a href="Liboevent.html#VALdel">del</a> [<a href="Liboevent.html">Liboevent</a>]</td> +<td><div class="info"> +Del the event +</div> +</td></tr> +<tr><td><a href="Liboevent.html#VALdispatch">dispatch</a> [<a href="Liboevent.html">Liboevent</a>]</td> +<td><div class="info"> +In order to process events, an application needs to call dispatch. +</div> +</td></tr> +<tr><td align="left"><br>F</td></tr> +<tr><td><a href="Liboevent.html#VALfd">fd</a> [<a href="Liboevent.html">Liboevent</a>]</td> +<td><div class="info"> +<code class="code">fd event</code> returns the file descriptor associated with the event +</div> +</td></tr> +<tr><td align="left"><br>L</td></tr> +<tr><td><a href="Liboevent.html#VALloop">loop</a> [<a href="Liboevent.html">Liboevent</a>]</td> +<td><div class="info"> +Provides an interface for single pass execution of pending events +</div> +</td></tr> +<tr><td align="left"><br>P</td></tr> +<tr><td><a href="Liboevent.html#VALpending">pending</a> [<a href="Liboevent.html">Liboevent</a>]</td> +<td></td></tr> +<tr><td align="left"><br>S</td></tr> +<tr><td><a href="Liboevent.html#VALset">set</a> [<a href="Liboevent.html">Liboevent</a>]</td> +<td><div class="info"> +<code class="code">set event fd type persist callback</code> initializes the event. +</div> +</td></tr> +<tr><td><a href="Liboevent.html#VALset_signal">set_signal</a> [<a href="Liboevent.html">Liboevent</a>]</td> +<td><div class="info"> +<code class="code">set_signal event signal persist callback</code> initializes the event. +</div> +</td></tr> +<tr><td><a href="Liboevent.html#VALsignal">signal</a> [<a href="Liboevent.html">Liboevent</a>]</td> +<td><div class="info"> +<code class="code">signal event</code> returns the signal associated with the event +</div> +</td></tr> +</table><br> +</body> +</html> \ 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 @@ +<html><head> +<link rel="stylesheet" href="style.css" type="text/css"> +<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type"> +<link rel="Start" href="index.html"> +<link title="Index of types" rel=Appendix href="index_types.html"> +<link title="Index of values" rel=Appendix href="index_values.html"> +<link title="Index of modules" rel=Appendix href="index_modules.html"> +<link title="Liboevent" rel="Chapter" href="Liboevent.html"><title>Liboevent</title> +</head> +<body> +<code class="code"><span class="keyword">sig</span><br> + <span class="keyword">type</span> event<br> + <span class="keyword">type</span> event_flags = <span class="constructor">TIMEOUT</span> <span class="keywordsign">|</span> <span class="constructor">READ</span> <span class="keywordsign">|</span> <span class="constructor">WRITE</span> <span class="keywordsign">|</span> <span class="constructor">SIGNAL</span><br> + <span class="keyword">type</span> event_callback = <span class="constructor">Unix</span>.file_descr <span class="keywordsign">-></span> <span class="constructor">Liboevent</span>.event_flags <span class="keywordsign">-></span> unit<br> + <span class="keyword">val</span> create : unit <span class="keywordsign">-></span> <span class="constructor">Liboevent</span>.event<br> + <span class="keyword">val</span> fd : <span class="constructor">Liboevent</span>.event <span class="keywordsign">-></span> <span class="constructor">Unix</span>.file_descr<br> + <span class="keyword">val</span> signal : <span class="constructor">Liboevent</span>.event <span class="keywordsign">-></span> int<br> + <span class="keyword">val</span> set :<br> + <span class="constructor">Liboevent</span>.event <span class="keywordsign">-></span><br> + <span class="constructor">Unix</span>.file_descr <span class="keywordsign">-></span><br> + <span class="constructor">Liboevent</span>.event_flags list <span class="keywordsign">-></span><br> + persist:bool <span class="keywordsign">-></span> <span class="constructor">Liboevent</span>.event_callback <span class="keywordsign">-></span> unit<br> + <span class="keyword">val</span> set_signal :<br> + <span class="constructor">Liboevent</span>.event <span class="keywordsign">-></span><br> + signal:int <span class="keywordsign">-></span> persist:bool <span class="keywordsign">-></span> <span class="constructor">Liboevent</span>.event_callback <span class="keywordsign">-></span> unit<br> + <span class="keyword">val</span> add : <span class="constructor">Liboevent</span>.event <span class="keywordsign">-></span> float option <span class="keywordsign">-></span> unit<br> + <span class="keyword">val</span> del : <span class="constructor">Liboevent</span>.event <span class="keywordsign">-></span> unit<br> + <span class="keyword">val</span> pending : <span class="constructor">Liboevent</span>.event <span class="keywordsign">-></span> <span class="constructor">Liboevent</span>.event_flags list <span class="keywordsign">-></span> bool<br> + <span class="keyword">val</span> dispatch : unit <span class="keywordsign">-></span> unit<br> + <span class="keyword">type</span> loop_flags = <span class="constructor">ONCE</span> <span class="keywordsign">|</span> <span class="constructor">NONBLOCK</span><br> + <span class="keyword">val</span> loop : <span class="constructor">Liboevent</span>.loop_flags <span class="keywordsign">-></span> unit<br> +<span class="keyword">end</span></code></body></html> \ 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 <sys/time.h> +#include <stdlib.h> +#include <event.h> +#include <string.h> + +#include <caml/mlvalues.h> +#include <caml/custom.h> +#include <caml/alloc.h> +#include <caml/memory.h> +#include <caml/callback.h> +#include <caml/fail.h> + +#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" ^ + "<html><h1>Hi There</h1>" ^ + "<pre>" ^ (String.sub buffer 0 len) ^ "</pre>" ^ + "</html" + in + let l = Unix.write fd response 0 (String.length response) in + Unix.close fd + in + Libevent.set write_event fd [Libevent.WRITE] false http_write_cb; + Libevent.add write_event None + + in + Libevent.set read_event client_fd [Libevent.READ] false http_read_cb; + Libevent.add read_event None + +let bind_server port = + let fd = Unix.socket Unix.PF_INET Unix.SOCK_STREAM 0 in + Unix.set_nonblock fd; + Unix.setsockopt fd Unix.SO_REUSEADDR true; + Unix.bind fd (Unix.ADDR_INET (Unix.inet_addr_any, port)); + Unix.listen fd 5; + fd + +let _ = + Unix.set_nonblock Unix.stdout; + Unix.set_nonblock Unix.stderr; + + let server_event = Libevent.create () in + let stdout_event = Libevent.create () in + let stderr_event = Libevent.create () in + + let server_fd = bind_server 8080 in + + let buflen = 10240 in + let buffer = String.create buflen in + + Libevent.set server_event server_fd [Libevent.READ] true + (http_server_cb buffer buflen); + Libevent.add server_event None; + + Libevent.dispatch (); diff -ruN ocaml-event.bak/work/ocaml-event-0.6.0/examples/signal_example.ml ocaml-event/work/ocaml-event-0.6.0/examples/signal_example.ml --- ocaml-event.bak/work/ocaml-event-0.6.0/examples/signal_example.ml 1970-01-01 03:00:00.000000000 +0300 +++ ocaml-event/work/ocaml-event-0.6.0/examples/signal_example.ml 2007-04-20 00:42:39.000000000 +0400 @@ -0,0 +1,32 @@ +(* + * Small example program + *) + +let signal_callback event called fd event_type = + (* Print information on the signal we received *) + Printf.printf "Got signal: %d\n" (Libevent.signal event); + flush stdout; + + called := !called - 1; + + if !called <= 0 then + Libevent.del event + +let _ = + let sigint = 2 in + + (* Create an event *) + let signal_event = Libevent.create () in + + (* Set the sigint signal *) + Libevent.set_signal signal_event sigint true + (signal_callback signal_event (ref 2)); + + (* Add the signal to the event library *) + Libevent.add signal_event None; + + Printf.printf "SIGINT me please!\n"; + flush stdout; + + (* Start the event dispatching mainloop *) + Libevent.dispatch () Files ocaml-event.bak/work/ocaml-event-0.6.0/libmloevent.a and ocaml-event/work/ocaml-event-0.6.0/libmloevent.a differ Files ocaml-event.bak/work/ocaml-event-0.6.0/liboevent.a and ocaml-event/work/ocaml-event-0.6.0/liboevent.a differ Files ocaml-event.bak/work/ocaml-event-0.6.0/liboevent.cma and ocaml-event/work/ocaml-event-0.6.0/liboevent.cma differ Files ocaml-event.bak/work/ocaml-event-0.6.0/liboevent.cmi and ocaml-event/work/ocaml-event-0.6.0/liboevent.cmi differ Files ocaml-event.bak/work/ocaml-event-0.6.0/liboevent.cmo and ocaml-event/work/ocaml-event-0.6.0/liboevent.cmo differ Files ocaml-event.bak/work/ocaml-event-0.6.0/liboevent.cmx and ocaml-event/work/ocaml-event-0.6.0/liboevent.cmx differ Files ocaml-event.bak/work/ocaml-event-0.6.0/liboevent.cmxa and ocaml-event/work/ocaml-event-0.6.0/liboevent.cmxa differ diff -ruN ocaml-event.bak/work/ocaml-event-0.6.0/liboevent.ml ocaml-event/work/ocaml-event-0.6.0/liboevent.ml --- ocaml-event.bak/work/ocaml-event-0.6.0/liboevent.ml 1970-01-01 03:00:00.000000000 +0300 +++ ocaml-event/work/ocaml-event-0.6.0/liboevent.ml 2009-11-26 11:49:02.000000000 +0300 @@ -0,0 +1,108 @@ +(***********************************************************************) +(* The OcamlEvent library *) +(* *) +(* Copyright 2002, 2003 Maas-Maarten Zeeman. All rights reserved. See *) +(* LICENCE for details. *) +(***********************************************************************) + +(* $Id: liboevent.ml,v 1.1 2009-11-26 08:49:02 maas Exp $ *) +type event + +type event_flags = + TIMEOUT + | READ + | WRITE + | SIGNAL + +let int_of_event_type = function + TIMEOUT -> 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:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200911292107.nATL784l057363>