http://code.google.com/p/bitmatch/
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.
http://et.redhat.com/~rjones/bitmatch/html/Bitmatch_persistent.html
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"
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