Browse files

import bin-prot-2.0.3

  • Loading branch information...
1 parent 1909ea1 commit 616a43bf7fb5cb33ba552d61d8c64d9f644df468 @avsm committed Oct 26, 2011
@@ -0,0 +1,31 @@
+# $OpenBSD$
+COMMENT= OCaml library to generate binary protocols
+V= 2.0.3
+DISTNAME= bin-prot-${V}
+MAINTAINER= Anil Madhavapeddy <>
+# LGPL+linking exception
+MODULES= lang/ocaml
+RUN_DEPENDS+= sysutils/findlib devel/type-conv
+ ${INSTALL_DATA_DIR} ${PREFIX}/lib/ocaml/site-lib/bin-prot
+.include <>
@@ -0,0 +1,5 @@
+MD5 (bin-prot-2.0.3.tar.gz) = lQq0vcp/W3Vw5NYhbv8jXQ==
+RMD160 (bin-prot-2.0.3.tar.gz) = /gIiGyDyuxdqKl5vKTyQZHD5Rc4=
+SHA1 (bin-prot-2.0.3.tar.gz) = V0Rza165NnYzxfwSTVMfbZ1m7l4=
+SHA256 (bin-prot-2.0.3.tar.gz) = 4wp/JerUAS93GSAbN869HQ/xqDnbW4THL/ofF1Mf7PU=
+SIZE (bin-prot-2.0.3.tar.gz) = 109427
@@ -0,0 +1,42 @@
+--- lib/common_stubs.h.orig Thu Sep 1 18:40:11 2011
++++ lib/common_stubs.h Wed Oct 26 22:34:21 2011
+@@ -31,7 +31,6 @@
+ #include <sys/types.h>
+ #include <string.h>
+-#include <arpa/inet.h>
+ #include <caml/config.h>
+ #include <caml/memory.h>
+@@ -47,6 +46,14 @@
+ #include "int64_emul.h"
+ #endif
++#if defined(__OpenBSD__)
++#define le16toh(x) htole16(x)
++#define le32toh(x) htole32(x)
++#define le64toh(x) htole64(x)
++#define be16toh(x) htobe16(x)
++#define be32toh(x) htobe32(x)
++#define be64toh(x) htobe64(x)
++#endif /* defined(__OpenBSD__) */
+ /* Endianness- and alignment-independent integer marshalling functions */
+@@ -63,13 +70,13 @@
+ #include <byteswap.h>
+ #endif /* __linux__ */
+-#if defined(__FreeBSD__) || defined(__NetBSD__)
++#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
+ #include <sys/endian.h>
+ #define bswap_16 bswap16
+ #define bswap_32 bswap32
+ #define bswap_64 bswap64
+-#endif /* defined(__FreeBSD__) || defined(__NetBSD__) */
++#endif /* defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) */
@@ -0,0 +1,33 @@
+This library contains functionality for reading and writing
+OCaml-values in a type-safe binary protocol. It is extremely
+efficient, typically supporting type-safe marshalling and unmarshalling
+of even highly structured values at speeds sufficient to saturate
+a gigabit connection. The protocol is also heavily optimized for
+size, making it ideal for long-term storage of large amounts of
+The library is highly dependable and safe to use: a rigorous test
+suite has to date guaranteed that this library has never exhibited
+a bug in production systems in several years of use. "Bin_prot" has
+been successfully employed in mission-critical financial applications,
+storing many terabytes of structured data derived from thousands
+of type definitions, and typically processing millions of messages
+a day in realtime for low-latency applications that must not crash.
+Since version two this library should work with all CPU architectures
+currently supported by OCaml, no matter the word size (32 or 64
+bit), endianness (2), or alignment requirements. It provides users
+with a convenient and safe way of performing I/O on any extensionally
+defined OCaml type (see later sections for details). Functions,
+objects, first-class modules, as well as values whose type is bound
+through a polymorphic record field are hence not supported. This
+is hardly ever a limitation in practice.
+As of now, there is no support for cyclic or shared values. Cyclic
+values will lead to non-termination whereas shared values, besides
+requiring more space when encoded, may lead to a substantial increase
+in memory footprint when they are read back. It would not be trivial
+to support these kinds of values in a type-safe way without noticably
+sacrificing performance. If these kinds of values are needed, the
+user may want to use the as of today still unsafe marshalling
+functions provided by OCaml.
@@ -0,0 +1,5 @@
+@comment $OpenBSD$
@@ -0,0 +1,2 @@
+@comment $OpenBSD$
@@ -0,0 +1,11 @@
+@comment $OpenBSD$

0 comments on commit 616a43b

Please sign in to comment.