caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* ANNOUNCE: Bitmatch 1.9 released
@ 2008-06-13 16:30 Richard Jones
  0 siblings, 0 replies; only message in thread
From: Richard Jones @ 2008-06-13 16:30 UTC (permalink / raw)
  To: caml-list

This is a preview/testing release:

  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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-06-13 16:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-06-13 16:30 ANNOUNCE: Bitmatch 1.9 released Richard Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).