Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[Caml-list] [ANNOUNCE] OCaml Bitstring 2.0.2

18 views
Skip to first unread message

Richard Jones

unread,
Jan 9, 2010, 5:08:21 AM1/9/10
to caml...@inria.fr

Bitstring is a syntax extension which adds Erlang-style bit matching
and construction to OCaml programs. You can use this to efficiently
and safely parse communication protocols and binary file formats.

Bitstring handles integers, booleans, strings, sub-bitstrings, big-,
little- and native-endianness, signed and unsigned types,
variable-width fields, fields whose width depends on values in
previous fields, fields with arbitrary bit alignment, forward offsets,
when-clauses, checked expressions, security against buffer overflows
and DoS, and lots more.

Example:

let bits = Bitstring.bitstring_of_file "image.gif" in
bitmatch bits with
| { ("GIF87a"|"GIF89a") : 6*8 : string; (* GIF magic. *)
width : 16 : littleendian;
height : 16 : littleendian } ->
printf "%s: GIF image is %d x %d pixels" filename width height
| { _ } ->
eprintf "%s: Not a GIF image\n" filename

The latest version is 2.0.2 which fixes a number of compilation
problems related to OCaml 3.11, and incorporates some unofficial
patches which were floating around. (Note that bitstring 2.0.0 is
known to be broken on Debian).

Home page:
http://code.google.com/p/bitstring/
API documentation:
http://people.redhat.com/~rjones/bitstring/html/Bitstring.html

Rich.

--
Richard Jones
Red Hat

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

Mehdi Dogguy

unread,
Jan 9, 2010, 5:56:45 AM1/9/10
to Richard Jones, caml...@inria.fr
Richard Jones wrote:
>
> The latest version is 2.0.2 which fixes a number of compilation
> problems related to OCaml 3.11, and incorporates some unofficial
> patches which were floating around. (Note that bitstring 2.0.0 is
> known to be broken on Debian).
>

Updated in Debian as well. OCaml Bitstring 2.0.2 will be available shortly.

Regards,

--
Mehdi Dogguy مهدي الدڤي
http://www.pps.jussieu.fr/~dogguy
Tel.: (+33).1.44.27.28.38

Matthieu Dubuget

unread,
Jan 9, 2010, 6:23:51 AM1/9/10
to caml...@yquem.inria.fr
For those who would want to use bitstring on mingw, I had it compiled ok
with the following:
> cp byteswap.in.h byteswap.h
> sed -i -e 's/-Werror -fPIC//' Makefile.in
> sed -i -e 's/open_in/open_in_bin/' pa_bitstring.ml
> create_test_pattern.ml bitstring_objinfo.ml
> ./configure CFLAGS="-mno-cygwin"
> make


The test target is also buggy on mingw.

But the library is working ok

Salutations

Matt

Matthieu Dubuget

unread,
Jan 9, 2010, 6:33:41 AM1/9/10
to caml...@yquem.inria.fr
Oups. I forgot one modification:

> cp byteswap.in.h byteswap.h
> sed -i -e 's/-Werror -fPIC//' -e 's/\*\.so/\*.dll/' Makefile.in


> sed -i -e 's/open_in/open_in_bin/' pa_bitstring.ml create_test_pattern.ml bitstring_objinfo.ml
> ./configure CFLAGS="-mno-cygwin"
> make

> make install

0 new messages