English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
ANNOUNCE: Bitmatch 1.9 released
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2008-06-13 (16:31)
From: Richard Jones <rich@a...>
Subject: ANNOUNCE: Bitmatch 1.9 released
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