[Caml-list] ANNOUNCE: Bitmatch 1.9 released

Skip to first unread message

Richard Jones

Jun 13, 2008, 12:31:19 PM6/13/08
to caml...@inria.fr
This is a preview/testing release:


The major change is the introduction of persistent patterns. This
allows you to write importer tools, so you can import bitstring
descriptions from your own languages or other sources.


I'm working on a C language importer, which will be able to import C
structures, unions, enums and constants (eg. out of header files).
This will be based on bitmatch & CIL, and there's an early prototype
included in the 1.9 release.

The syntax for this is simple and lightweight. For example, to
implement the equivalent of the 'df' command (showing free blocks on a
filesystem) you could do something like this:

(* bitmatch-import-c ext3.c > ext3.bmpp *)
open bitmatch "ext3.bmpp"

let () =
let fd = Unix.openfile "/dev/sda1" in
let bits = Bitmatch.bitstring_of_file_descr_max fd 4096 in

bitmatch bits with
| { :ext3_super_block } ->
printf "free blocks = %ld\n" s_free_blocks_count
| { _ } ->
printf "/dev/sda1 is not an ext3 filesystem\n"


Richard Jones
Red Hat

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

Reply all
Reply to author
0 new messages