Renaming bitmatch -> bitstring.
authorRichard W.M. Jones <rich@annexia.org>
Thu, 17 Jul 2008 15:45:56 +0000 (15:45 +0000)
committerRichard W.M. Jones <rich@annexia.org>
Thu, 17 Jul 2008 15:45:56 +0000 (15:45 +0000)
45 files changed:
.depend
MANIFEST
META.in
Makefile.in
README
bitmatch.ml [new file with mode: 0644]
bitstring.ml
bitstring.mli
bitstring_config.ml.in
bitstring_objinfo.ml
bitstring_persistent.ml
bitstring_persistent.mli
bitstring_types.ml
cil-tools/.depend
cil-tools/Makefile.in
cil-tools/bitstring-import-prefix.h
cil-tools/bitstring_import_c.ml
cil-tools/ext3.c
cil-tools/ext3.ml
cil-tools/task_struct.c
cil-tools/task_struct.ml
configure.ac
create_test_pattern.ml
examples/elf.ml
examples/ext3_superblock.ml
examples/gif.ml
examples/ipv4_header.ml
examples/libpcap.ml
examples/make_ipv4_header.ml
examples/ping.ml
pa_bitstring.ml
tests/01_load.ml
tests/02_run.ml
tests/10_match_bits.ml
tests/11_match_ints.ml
tests/20_varsize.ml
tests/30_bitbuffer.ml
tests/40_endianexpr.ml
tests/50_named_pattern.ml
tests/51_open_pattern.ml
tests/60_simple_offset.ml
tests/61_offset_string.ml
tests/62_offset_padding.ml
tests/65_save_offset_to.ml
tests/70_check_and_bind.ml

diff --git a/.depend b/.depend
index 742f846..a57227c 100644 (file)
--- a/.depend
+++ b/.depend
@@ -1,9 +1,9 @@
-bitmatch.cmo: bitmatch_types.cmo bitmatch_config.cmo bitmatch.cmi 
-bitmatch.cmx: bitmatch_types.cmx bitmatch_config.cmx bitmatch.cmi 
-bitmatch_objinfo.cmo: bitmatch_persistent.cmi bitmatch.cmi 
-bitmatch_objinfo.cmx: bitmatch_persistent.cmx bitmatch.cmx 
-bitmatch_persistent.cmo: bitmatch.cmi bitmatch_persistent.cmi 
-bitmatch_persistent.cmx: bitmatch.cmx bitmatch_persistent.cmi 
-bitmatch_persistent.cmi: bitmatch.cmi 
-create_test_pattern.cmo: bitmatch_persistent.cmi 
-create_test_pattern.cmx: bitmatch_persistent.cmx 
+bitstring.cmo: bitstring_types.cmo bitstring_config.cmo bitstring.cmi 
+bitstring.cmx: bitstring_types.cmx bitstring_config.cmx bitstring.cmi 
+bitstring_objinfo.cmo: bitstring_persistent.cmi bitstring.cmi 
+bitstring_objinfo.cmx: bitstring_persistent.cmx bitstring.cmx 
+bitstring_persistent.cmo: bitstring.cmi bitstring_persistent.cmi 
+bitstring_persistent.cmx: bitstring.cmx bitstring_persistent.cmi 
+bitstring_persistent.cmi: bitstring.cmi 
+create_test_pattern.cmo: bitstring_persistent.cmi 
+create_test_pattern.cmx: bitstring_persistent.cmx 
index e4820e7..30cfd08 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -1,14 +1,15 @@
 aclocal.m4
 bitmatch.ml
-bitmatch.mli
-bitmatch_config.ml.in
-bitmatch_objinfo.ml
-bitmatch_persistent.ml
-bitmatch_persistent.mli
-bitmatch_types.ml
+bitstring.ml
+bitstring.mli
+bitstring_config.ml.in
+bitstring_objinfo.ml
+bitstring_persistent.ml
+bitstring_persistent.mli
+bitstring_types.ml
 .depend
-cil-tools/bitmatch_import_c.ml
-cil-tools/bitmatch-import-prefix.h
+cil-tools/bitstring_import_c.ml
+cil-tools/bitstring-import-prefix.h
 cil-tools/.depend
 cil-tools/ext3.c
 cil-tools/ext3.ml
@@ -34,7 +35,7 @@ Makefile.in
 MANIFEST
 META.in
 README
-pa_bitmatch.ml
+pa_bitstring.ml
 tests/01_load.ml
 tests/02_run.ml
 tests/10_match_bits.ml
diff --git a/META.in b/META.in
index 97be0ff..6e99669 100644 (file)
--- a/META.in
+++ b/META.in
@@ -1,22 +1,22 @@
-name = "bitmatch"
+name = "bitstring"
 version = "@PACKAGE_VERSION@"
 description = "Bitstrings and bitstring matching"
 requires = "unix"
-archive(byte) = "bitmatch.cma"
-archive(native) = "bitmatch.cmxa"
+archive(byte) = "bitstring.cma"
+archive(native) = "bitstring.cmxa"
 
 package "persistent" (
-  requires = "bitmatch"
+  requires = "bitstring"
   version = "@PACKAGE_VERSION@"
-  description = "Persistent patterns for bitmatch (requires camlp4)"
-  archive(byte) = "bitmatch_persistent.cma"
-  archive(native) = "bitmatch_persistent.cmxa"
+  description = "Persistent patterns for bitstring (requires camlp4)"
+  archive(byte) = "bitstring_persistent.cma"
+  archive(native) = "bitstring_persistent.cmxa"
 )
 
 package "syntax" (
   version = "@PACKAGE_VERSION@"
-  description = "Syntax extension: bitmatch operators"
-  archive(syntax,preprocessor) = "unix.cma bitmatch.cma bitmatch_persistent.cma pa_bitmatch.cmo"
-  archive(syntax,toploop) = "unix.cma bitmatch.cma bitmatch_persistent.cma pa_bitmatch.cmo"
+  description = "Syntax extension: bitstring operators"
+  archive(syntax,preprocessor) = "unix.cma bitstring.cma bitstring_persistent.cma pa_bitstring.cmo"
+  archive(syntax,toploop) = "unix.cma bitstring.cma bitstring_persistent.cma pa_bitstring.cmo"
   preprocessor = "camlp4of"
 )
index a697d39..c60a315 100644 (file)
@@ -1,4 +1,4 @@
-# Bitmatch syntax extension.
+# Bitstring syntax extension.
 # Copyright (C) 2008 Red Hat Inc., Richard W.M. Jones
 #
 # This library is free software; you can redistribute it and/or
@@ -46,54 +46,56 @@ EXAMPLES    = $(patsubst %.ml,%,$(wildcard examples/*.ml))
 
 TESTS          = $(patsubst %.ml,%,$(wildcard tests/*.ml))
 
-all:   bitmatch.cma bitmatch_persistent.cma \
-       bitmatch.cmxa bitmatch_persistent.cmxa \
-       pa_bitmatch.cmo \
-       bitmatch-objinfo
+all:   bitstring.cma bitstring_persistent.cma \
+       bitstring.cmxa bitstring_persistent.cmxa \
+       pa_bitstring.cmo \
+       bitstring-objinfo
        @for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
 
-bitmatch.cma: bitmatch_types.cmo bitmatch_config.cmo bitmatch.cmo
+bitstring.cma: bitstring_types.cmo bitstring_config.cmo bitstring.cmo \
+         bitmatch.cmo
        $(OCAMLFIND) ocamlc -a -o $@ $^
 
-bitmatch_persistent.cma: bitmatch_persistent.cmo
+bitstring_persistent.cma: bitstring_persistent.cmo
        $(OCAMLFIND) ocamlc -a -o $@ $^
 
-bitmatch_persistent.cmo: bitmatch_persistent.ml
+bitstring_persistent.cmo: bitstring_persistent.ml
        $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(OCAMLCPACKAGES) \
          -I +camlp4 -pp camlp4of -c $<
 
-bitmatch.cmxa: bitmatch_types.cmx bitmatch_config.cmx bitmatch.cmx
+bitstring.cmxa: bitstring_types.cmx bitstring_config.cmx bitstring.cmx \
+         bitmatch.cmx
        $(OCAMLFIND) ocamlopt -a -o $@ $^
 
-bitmatch_persistent.cmxa: bitmatch_persistent.cmx
+bitstring_persistent.cmxa: bitstring_persistent.cmx
        $(OCAMLFIND) ocamlopt -a -o $@ $^
 
-bitmatch_persistent.cmx: bitmatch_persistent.ml
+bitstring_persistent.cmx: bitstring_persistent.ml
        $(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) $(OCAMLOPTPACKAGES) \
          -I +camlp4 -pp camlp4of -c $<
 
-bitmatch_persistent.cmi: bitmatch_persistent.mli
+bitstring_persistent.cmi: bitstring_persistent.mli
        $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(OCAMLCPACKAGES) \
          -I +camlp4 -pp camlp4of -c $<
 
-pa_bitmatch.cmo: pa_bitmatch.ml bitmatch.cma bitmatch_persistent.cma
-       $(OCAMLFIND) ocamlc bitmatch.cma -I +camlp4 camlp4lib.cma \
+pa_bitstring.cmo: pa_bitstring.ml bitstring.cma bitstring_persistent.cma
+       $(OCAMLFIND) ocamlc bitstring.cma -I +camlp4 camlp4lib.cma \
          -pp camlp4of -c $< -o $@
 
-bitmatch-objinfo: bitmatch_objinfo.cmo bitmatch.cma bitmatch_persistent.cma
+bitstring-objinfo: bitstring_objinfo.cmo bitstring.cma bitstring_persistent.cma
        $(OCAMLFIND) ocamlc -I +camlp4 unix.cma camlp4lib.cma \
-         bitmatch.cma bitmatch_persistent.cma \
+         bitstring.cma bitstring_persistent.cma \
          $< -o $@
 
 # Tests and examples.
 
-PP     = -pp "camlp4o bitmatch.cma bitmatch_persistent.cma pa_bitmatch.cmo"
+PP     = -pp "camlp4o bitstring.cma bitstring_persistent.cma pa_bitstring.cmo"
 
-test: pa_bitmatch.cmo bitmatch.cma bitmatch_persistent.cma tests/test.bmpp
+test: pa_bitstring.cmo bitstring.cma bitstring_persistent.cma tests/test.bmpp
        @for f in $(TESTS); do \
          echo Building $$f; \
          $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(PP) \
-           -package unix -linkpkg -I . bitmatch.cma $$f.ml -o $$f; \
+           -package unix -linkpkg -I . bitstring.cma $$f.ml -o $$f; \
          if [ $$? -ne 0 ]; then exit 1; fi; \
          echo Running $$f; \
          $$f; \
@@ -108,35 +110,35 @@ tests/test.bmpp: create_test_pattern
 create_test_pattern: create_test_pattern.cmo
        $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -pp camlp4of \
          unix.cma -I +camlp4 camlp4lib.cma \
-         -I . bitmatch.cma bitmatch_persistent.cma $< -o $@
+         -I . bitstring.cma bitstring_persistent.cma $< -o $@
 
 create_test_pattern.cmo: create_test_pattern.ml
        $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -pp camlp4of \
          unix.cma -I +camlp4 \
          -I . -c $< -o $@
 
-examples: pa_bitmatch.cmo bitmatch.cma bitmatch_persistent.cma
+examples: pa_bitstring.cmo bitstring.cma bitstring_persistent.cma
        @for f in $(EXAMPLES); do \
          echo Building $$f; \
          $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(PP) \
-           -package unix -linkpkg -I . bitmatch.cma $$f.ml -o $$f; \
+           -package unix -linkpkg -I . bitstring.cma $$f.ml -o $$f; \
          if [ $$? -ne 0 ]; then exit 1; fi; \
        done
        @for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
 
-print-tests: pa_bitmatch.cmo bitmatch_persistent.cma
+print-tests: pa_bitstring.cmo bitstring_persistent.cma
        @for f in $(TESTS); do \
          echo Test: $$f.ml; \
-         cmd="camlp4o bitmatch.cma bitmatch_persistent.cma pa_bitmatch.cmo \
+         cmd="camlp4o bitstring.cma bitstring_persistent.cma pa_bitstring.cmo \
            -printer pr_o.cmo $$f.ml"; \
          echo $$cmd; \
          $$cmd; \
        done
 
-print-examples: pa_bitmatch.cmo
+print-examples: pa_bitstring.cmo
        @for f in $(EXAMPLES); do \
          echo Example: $$f.ml; \
-         camlp4o bitmatch.cma bitmatch_persistent.cma pa_bitmatch.cmo \
+         camlp4o bitstring.cma bitstring_persistent.cma pa_bitstring.cmo \
            -printer pr_o.cmo $$f.ml; \
          if [ $$? -ne 0 ]; then exit 1; fi; \
        done
@@ -152,7 +154,8 @@ clean:
 distclean: clean
        rm -rf autom4te.cache
        rm -f config.log config.status
-       rm -f config.h Makefile META bitmatch_config.ml
+       rm -f config.h Makefile META bitstring_config.ml
+       rm -f bitstring-objinfo
        @for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
 
 # Documentation.
@@ -162,16 +165,16 @@ doc:
        rm -rf html
        mkdir html
        $(OCAMLDOC) $(OCAMLDOCFLAGS) -d html -I +camlp4 \
-         bitmatch.mli bitmatch_persistent.mli
+         bitstring.mli bitstring_persistent.mli
 endif
 
 # Install.
 
 install:
-       ocamlfind install bitmatch META *.mli *.cmx *.cma *.cmxa *.a \
-               bitmatch.cmi \
-               bitmatch_persistent.cmi \
-               pa_bitmatch.cmo
+       ocamlfind install bitstring META *.mli *.cmx *.cma *.cmxa *.a \
+               bitstring.cmi \
+               bitstring_persistent.cmi \
+               pa_bitstring.cmo
        @for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
 
 # Standard rules.
@@ -186,16 +189,16 @@ install:
 depend: .depend
        @for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
 
-.depend: bitmatch.ml bitmatch.mli \
-         bitmatch_persistent.ml bitmatch_persistent.mli \
-         bitmatch_objinfo.ml \
+.depend: bitstring.ml bitstring.mli \
+         bitstring_persistent.ml bitstring_persistent.mli \
+         bitstring_objinfo.ml \
          create_test_pattern.ml
        rm -f .depend
        $(OCAMLFIND) ocamldep $(OCAMLCPACKAGES) \
-         bitmatch.ml bitmatch.mli \
-         bitmatch_objinfo.ml >> $@
+         bitstring.ml bitstring.mli \
+         bitstring_objinfo.ml >> $@
        $(OCAMLFIND) ocamldep $(OCAMLCPACKAGES) -pp camlp4of \
-         bitmatch_persistent.ml bitmatch_persistent.mli \
+         bitstring_persistent.ml bitstring_persistent.mli \
          create_test_pattern.ml >> $@
 
 ifeq ($(wildcard .depend),.depend)
diff --git a/README b/README
index d875608..f49f63a 100644 (file)
--- a/README
+++ b/README
@@ -1,4 +1,6 @@
-ocaml-bitmatch Copyright (C) 2008 Red Hat Inc, Richard W.M. Jones.
+ocaml-bitstring Copyright (C) 2008 Red Hat Inc, Richard W.M. Jones.
+
+This library was formerly known as 'bitmatch'.
 
 Please see the html subdirectory for developer documentation.
 
diff --git a/bitmatch.ml b/bitmatch.ml
new file mode 100644 (file)
index 0000000..2d1992b
--- /dev/null
@@ -0,0 +1,27 @@
+(** Bitmatch backwards compatibility library. *)
+(* Bitstring library.
+ * Copyright (C) 2008 Red Hat Inc., Richard W.M. Jones
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version,
+ * with the OCaml linking exception described in COPYING.LIB.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * $Id$
+ *)
+(** This is just for backwards compatibility with code
+    from when the library was called bitmatch.  You should
+    replace all references to this module with {!Bitstring}.
+*)
+
+include Bitstring
index 38e7032..44dc1f2 100644 (file)
@@ -1,4 +1,4 @@
-(* Bitmatch library.
+(* Bitstring library.
  * Copyright (C) 2008 Red Hat Inc., Richard W.M. Jones
  *
  * This library is free software; you can redistribute it and/or
 
 open Printf
 
-include Bitmatch_types
-include Bitmatch_config
+include Bitstring_types
+include Bitstring_config
 
 (* Enable runtime debug messages.  Must also have been enabled
- * in pa_bitmatch.ml.
+ * in pa_bitstring.ml.
  *)
 let debug = ref false
 
@@ -166,7 +166,7 @@ module I = struct
     else if bits = 31 then
       minus_one
     else
-      invalid_arg "Bitmatch.I.mask"
+      invalid_arg "Bitstring.I.mask"
 
   (* Byte swap an int of a given size. *)
   let byteswap v bits =
@@ -237,7 +237,7 @@ module I32 = struct
     else if bits = 32 then
       minus_one
     else
-      invalid_arg "Bitmatch.I32.mask"
+      invalid_arg "Bitstring.I32.mask"
 
   (* Byte swap an int of a given size. *)
   let byteswap v bits =
@@ -308,7 +308,7 @@ module I64 = struct
     else if bits = 64 then
       minus_one
     else
-      invalid_arg "Bitmatch.I64.mask"
+      invalid_arg "Bitstring.I64.mask"
 
   (* Byte swap an int of a given size. *)
   (* let byteswap v bits = *)
@@ -661,7 +661,7 @@ module Buffer = struct
 
   (* Add exactly 8 bits. *)
   let add_byte ({ buf = buf; len = len; last = last } as t) byte =
-    if byte < 0 || byte > 255 then invalid_arg "Bitmatch.Buffer.add_byte";
+    if byte < 0 || byte > 255 then invalid_arg "Bitstring.Buffer.add_byte";
     let shift = len land 7 in
     if shift = 0 then
       (* Target buffer is byte-aligned. *)
@@ -693,7 +693,7 @@ module Buffer = struct
    * to call add_bit so it's slow.
    *)
   let _add_bits t c slen =
-    if slen < 1 || slen >= 8 then invalid_arg "Bitmatch.Buffer._add_bits";
+    if slen < 1 || slen >= 8 then invalid_arg "Bitstring.Buffer._add_bits";
     for i = slen-1 downto 0 do
       let bit = c land (1 lsl i) <> 0 in
       add_bit t bit
index 800cadd..69b56c1 100644 (file)
@@ -1,4 +1,4 @@
-(** Bitmatch library. *)
+(** Bitstring library. *)
 (* Copyright (C) 2008 Red Hat Inc., Richard W.M. Jones
  *
  * This library is free software; you can redistribute it and/or
 
    {2 Introduction}
 
-   Bitmatch adds Erlang-style bitstrings and matching over bitstrings
+   Bitstring adds Erlang-style bitstrings and matching over bitstrings
    as a syntax extension and library for OCaml.  You can use
    this module to both parse and generate binary formats, for
    example, communications protocols, disk formats and binary files.
 
-   {{:http://code.google.com/p/bitmatch/}OCaml bitmatch website}
+   {{:http://code.google.com/p/bitstring/}OCaml bitstring website}
+
+   This library used to be called "bitmatch".
 
    {2 Examples}
 
@@ -76,9 +78,9 @@ let display pkt =
     printf "  checksum: %d\n" checksum;
     printf "  source: %lx  dest: %lx\n" source dest;
     printf "  header options + padding:\n";
-    Bitmatch.hexdump_bitstring stdout options;
+    Bitstring.hexdump_bitstring stdout options;
     printf "  packet payload:\n";
-    Bitmatch.hexdump_bitstring stdout payload
+    Bitstring.hexdump_bitstring stdout payload
 
   | { version : 4 } ->
     eprintf "unknown IP version %d\n" version;
@@ -86,7 +88,7 @@ let display pkt =
 
   | { _ } as pkt ->
     eprintf "data is smaller than one nibble:\n";
-    Bitmatch.hexdump_bitstring stderr pkt;
+    Bitstring.hexdump_bitstring stderr pkt;
     exit 1
 ]}
 
@@ -94,7 +96,7 @@ let display pkt =
    {{:http://lxr.linux.no/linux/include/linux/ext3_fs.h}Linux EXT3 filesystem superblocks}:
 
 {[
-let bits = Bitmatch.bitstring_of_file "tests/ext3_sb"
+let bits = Bitstring.bitstring_of_file "tests/ext3_sb"
 
 let () =
   bitmatch bits with
@@ -241,7 +243,7 @@ bitmatch bits with
 {[
 | { n : 4;
     rest : -1 : bitstring }
-    when Bitmatch.bitstring_length rest = 0 -> ...
+    when Bitstring.bitstring_length rest = 0 -> ...
 
    (* Only matches exactly 4 bits. *)
 ]}
@@ -348,7 +350,7 @@ let bits =
       the integer 1, and the following 12 bits containing the integer 10,
       arranged in network byte order. *)
 
-Bitmatch.hexdump_bitstring stdout bits ;;
+Bitstring.hexdump_bitstring stdout bits ;;
 
    (* Prints:
 
@@ -526,24 +528,24 @@ bitmatch bits with
 
    {2 Named patterns and persistent patterns}
 
-   Please see {!Bitmatch_persistent} for documentation on this subject.
+   Please see {!Bitstring_persistent} for documentation on this subject.
 
    {2 Compiling}
 
    Using the compiler directly you can do:
 
    {v
-   ocamlc -I +bitmatch \
-     -pp "camlp4of bitmatch.cma bitmatch_persistent.cma \
-            `ocamlc -where`/bitmatch/pa_bitmatch.cmo" \
-     unix.cma bitmatch.cma test.ml -o test
+   ocamlc -I +bitstring \
+     -pp "camlp4of bitstring.cma bitstring_persistent.cma \
+            `ocamlc -where`/bitstring/pa_bitstring.cmo" \
+     unix.cma bitstring.cma test.ml -o test
    v}
 
    Simpler method using findlib:
 
    {v
    ocamlfind ocamlc \
-     -package bitmatch,bitmatch.syntax -syntax bitmatch.syntax \
+     -package bitstring,bitstring.syntax -syntax bitstring.syntax \
      -linkpkg test.ml -o test
    v}
 
@@ -578,7 +580,7 @@ bitmatch bits with
 
    However the above does not necessarily apply to strings used in
    matching, since they may cause the library to use the
-   {!Bitmatch.string_of_bitstring} function, which allocates a string.
+   {!Bitstring.string_of_bitstring} function, which allocates a string.
    So you should take care if you use the [string] type particularly
    with a computed length that is derived from external input.
 
@@ -611,9 +613,10 @@ bitmatch bits with
    Note that the when-clause is evaluated {i last}, so if you are
    relying on the when-clause to filter cases then your code may do a
    lot of extra and unncessary pattern-matching work on fields which
-   may never be needed just to evaluate the when-clause.  You can
-   usually rearrange the code to do only the first part of the match,
-   followed by the when-clause, followed by a second inner bitmatch.
+   may never be needed just to evaluate the when-clause.  Either
+   rearrange the code to do only the first part of the match,
+   followed by the when-clause, followed by a second inner bitmatch,
+   or use a [check()] qualifier within fields.
 
    {3 Safety}
 
@@ -850,7 +853,7 @@ end
 (** {3 Miscellaneous} *)
 
 val package : string
-(** The package name, always ["ocaml-bitmatch"] *)
+(** The package name, always ["ocaml-bitstring"] *)
 
 val version : string
 (** The package version as a string. *)
@@ -858,7 +861,7 @@ val version : string
 val debug : bool ref
 (** Set this variable to true to enable extended debugging.
     This only works if debugging was also enabled in the
-    [pa_bitmatch.ml] file at compile time, otherwise it
+    [pa_bitstring.ml] file at compile time, otherwise it
     does nothing. *)
 
 (**/**)
index b1722bd..4d67990 100644 (file)
@@ -1,4 +1,4 @@
-(* Bitmatch library.
+(* Bitstring library.
  * Copyright (C) 2008 Red Hat Inc., Richard W.M. Jones
  *
  * @configure_input@
@@ -25,7 +25,7 @@
  * configure script.
  *)
 
-let nativeendian = Bitmatch_types.@NATIVEENDIAN@
+let nativeendian = Bitstring_types.@NATIVEENDIAN@
 
 let package = "@PACKAGE_NAME@"
 let version = "@PACKAGE_VERSION@"
index 90c52e4..c74de69 100644 (file)
@@ -1,4 +1,4 @@
-(* Bitmatch syntax extension.
+(* Bitstring syntax extension.
  * Copyright (C) 2008 Red Hat Inc., Richard W.M. Jones
  *
  * This program is free software; you can redistribute it and/or modify
 
 open Printf
 
-open Bitmatch
-module P = Bitmatch_persistent
+open Bitstring
+module P = Bitstring_persistent
 
 let () =
   if Array.length Sys.argv <= 1 then
-    failwith "bitmatch_objinfo filename.bmpp";
+    failwith "bitstring-objinfo filename.bmpp";
   let filename = Sys.argv.(1) in
   let chan = open_in filename in
   let names = ref [] in
index c848e36..6177b1d 100644 (file)
@@ -1,4 +1,4 @@
-(* Bitmatch persistent patterns.
+(* Bitstring persistent patterns.
  * Copyright (C) 2008 Red Hat Inc., Richard W.M. Jones
  *
  * This library is free software; you can redistribute it and/or
@@ -46,7 +46,7 @@ type 'a field = {
 }
 and field_type = Int | String | Bitstring (* field type *)
 and endian_expr =
-  | ConstantEndian of Bitmatch.endian  (* a constant little/big/nativeendian *)
+  | ConstantEndian of Bitstring.endian (* a constant little/big/nativeendian *)
   | EndianExpr of expr                 (* an endian expression *)
 
 type pattern = patt field list
@@ -120,7 +120,7 @@ let _string_of_field { flen = flen;
     | None -> "[non-const-len]" in
   let endian =
     match endian with
-    | ConstantEndian endian -> Bitmatch.string_of_endian endian
+    | ConstantEndian endian -> Bitstring.string_of_endian endian
     | EndianExpr _ -> "endian([expr])" in
   let signed = if signed then "signed" else "unsigned" in
   let t = string_of_field_type t in
@@ -189,7 +189,7 @@ let create_pattern_field _loc =
   {
     field = <:patt< _ >>;
     flen = <:expr< 32 >>;
-    endian = ConstantEndian Bitmatch.BigEndian;
+    endian = ConstantEndian Bitstring.BigEndian;
     signed = false;
     t = Int;
     _loc = _loc;
@@ -242,7 +242,7 @@ let create_constructor_field _loc =
   {
     field = <:expr< 0 >>;
     flen = <:expr< 32 >>;
-    endian = ConstantEndian Bitmatch.BigEndian;
+    endian = ConstantEndian Bitstring.BigEndian;
     signed = false;
     t = Int;
     _loc = _loc;
index 9c12d99..250306a 100644 (file)
@@ -1,4 +1,4 @@
-(** Bitmatch persistent patterns. *)
+(** Bitstring persistent patterns. *)
 (* Copyright (C) 2008 Red Hat Inc., Richard W.M. Jones
  *
  * This library is free software; you can redistribute it and/or
 (**
    {b Warning:} This documentation is for ADVANCED USERS ONLY.
    If you are not an advanced user, you are probably looking
-   for {{:Bitmatch.html}the Bitmatch documentation}.
+   for {{:Bitstring.html}the Bitstring documentation}.
 
    {{:#reference}Jump straight to the reference section for
    documentation on types and functions}.
 
    {2 Introduction}
 
-   Bitmatch allows you to name sets of fields and reuse them
+   Bitstring allows you to name sets of fields and reuse them
    elsewhere.  For example if you frequently need to parse
    Pascal-style strings in the form length byte + string, then you
    could name the [{ strlen : 8 : int; str : strlen*8 : string }]
@@ -75,7 +75,7 @@ v}
    'Persistent' refers to the fact that they can be saved into binary
    files.  However these binary files use OCaml [Marshal] module and
    depend (sometimes) on the version of OCaml used to generate them
-   and (sometimes) the version of bitmatch used.  So your build system
+   and (sometimes) the version of bitstring used.  So your build system
    should rebuild these files from source when your code is rebuilt.
 
    Persistent patterns are syntactic.  They work in the same way
@@ -87,14 +87,14 @@ v}
    Programs which generate and manipulate persistent patterns have to
    link to camlp4.  Since camlp4 in OCaml >= 3.10 is rather large, we
    have placed this code into this separate submodule, so that
-   programs which just use bitmatch don't need to pull in the whole of
+   programs which just use bitstring don't need to pull in the whole of
    camlp4.  This restriction does not apply to code which only uses
    persistent patterns but does not generate them.  If the distinction
    isn't clear, use [ocamlobjinfo] to look at the dependencies of your
    [*.cmo] files.
 
    Persistent patterns can be generated in several ways, but they
-   can only be {i used} by the [pa_bitmatch] syntax extension.
+   can only be {i used} by the [pa_bitstring] syntax extension.
    This means they are purely compile-time constructs.  You
    cannot use them to make arbitrary patterns and run those
    patterns (not unless your program runs [ocamlc] to make a [*.cmo]
@@ -169,9 +169,9 @@ v}
    - Relative to the current directory
    - Relative to the OCaml library directory
 
-   {3 bitmatch-objinfo}
+   {3 bitstring-objinfo}
 
-   The [bitmatch-objinfo] command can be run on a file in order
+   The [bitstring-objinfo] command can be run on a file in order
    to print out the patterns in the file.
 
    {3 Constructors}
@@ -313,14 +313,14 @@ val named_from_channel : in_channel -> named
 
     Note: This is not type safe.  The pattern/constructor must
     have been written out under the same version of OCaml and
-    the same version of bitmatch. *)
+    the same version of bitstring. *)
 
 val named_from_string : string -> int -> named
 (** Load a pattern/constructor from a string at offset within the string.
 
     Note: This is not type safe.  The pattern/constructor must
     have been written out under the same version of OCaml and
-    the same version of bitmatch. *)
+    the same version of bitstring. *)
 
 (** {3 Create pattern fields}
 
@@ -384,11 +384,11 @@ val set_length : 'a field -> expr -> 'a field
     The effect is that the field [{ len : 2*i : string }] could
     be created by calling [set_length field <:expr< 2*i >>]. *)
 
-val set_endian : 'a field -> Bitmatch.endian -> 'a field
+val set_endian : 'a field -> Bitstring.endian -> 'a field
 (** Sets the endianness of a field to the constant endianness.
 
     The effect is that the field [{ _ : 16 : bigendian }] could
-    be created by calling [set_endian field Bitmatch.BigEndian]. *)
+    be created by calling [set_endian field Bitstring.BigEndian]. *)
 
 val set_endian_expr : 'a field -> expr -> 'a field
 (** Sets the endianness of a field to an endianness expression.
@@ -422,7 +422,7 @@ val set_type_bitstring : 'a field -> 'a field
 
 val set_location : 'a field -> loc_t -> 'a field
 (** Sets the source code location of a field.  This is used when
-    pa_bitmatch displays error messages. *)
+    pa_bitstring displays error messages. *)
 
 val set_offset_int : 'a field -> int -> 'a field
 (** Set the offset expression for a field to the given number.
@@ -508,7 +508,7 @@ val get_length : 'a field -> expr
     is an OCaml expression, since lengths can be non-constant. *)
 
 type endian_expr =
-  | ConstantEndian of Bitmatch.endian
+  | ConstantEndian of Bitstring.endian
   | EndianExpr of expr
 
 val get_endian : 'a field -> endian_expr
index bd40954..459bc4f 100644 (file)
@@ -1,4 +1,4 @@
-(* Bitmatch library.
+(* Bitstring library.
  * Copyright (C) 2008 Red Hat Inc., Richard W.M. Jones
  *
  * This library is free software; you can redistribute it and/or
index ae0d049..8def24e 100644 (file)
@@ -1,4 +1,4 @@
-bitmatch_import_c.cmo: ../bitmatch_persistent.cmi ../bitmatch_config.cmo \
-    ../bitmatch.cmi 
-bitmatch_import_c.cmx: ../bitmatch_persistent.cmx ../bitmatch_config.cmx \
-    ../bitmatch.cmx 
+bitstring_import_c.cmo: ../bitstring_persistent.cmi ../bitstring_config.cmo \
+    ../bitstring.cmi 
+bitstring_import_c.cmx: ../bitstring_persistent.cmx ../bitstring_config.cmx \
+    ../bitstring.cmx 
index c596b0e..8fbe59c 100644 (file)
@@ -1,4 +1,4 @@
-# Bitmatch syntax extension.
+# Bitstring CIL tools for processing C code.
 # Copyright (C) 2008 Red Hat Inc., Richard W.M. Jones
 #
 # This library is free software; you can redistribute it and/or
@@ -27,21 +27,21 @@ INSTALL             = @INSTALL@
 
 OCAMLCFLAGS    = -g
 OCAMLCPACKAGES = -package unix,str,extlib,cil -I +camlp4 -I ..
-OCAMLCLIBS     = $(OCAMLCPACKAGES) camlp4lib.cma -linkpkg ../bitmatch.cma ../bitmatch_persistent.cma
+OCAMLCLIBS     = $(OCAMLCPACKAGES) camlp4lib.cma -linkpkg ../bitstring.cma ../bitstring_persistent.cma
 OCAMLOPTFLAGS  =
 OCAMLOPTPACKAGES = $(OCAMLCPACKAGES)
-OCAMLOPTLIBS   = $(OCAMLOPTPACKAGES) camlp4lib.cmxa -linkpkg ../bitmatch.cmxa ../bitmatch_persistent.cmxa
+OCAMLOPTLIBS   = $(OCAMLOPTPACKAGES) camlp4lib.cmxa -linkpkg ../bitstring.cmxa ../bitstring_persistent.cmxa
 
-PP             = -pp "camlp4o -I .. bitmatch.cma bitmatch_persistent.cma pa_bitmatch.cmo"
+PP             = -pp "camlp4o -I .. bitstring.cma bitstring_persistent.cma pa_bitstring.cmo"
 
 OCAMLDOCFLAGS  = -html -sort
 
-all:           bitmatch-import-c bitmatch-import-c.opt
+all:           bitstring-import-c bitstring-import-c.opt
 
-bitmatch-import-c: bitmatch_import_c.cmo
+bitstring-import-c: bitstring_import_c.cmo
        $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(OCAMLCLIBS) $< -o $@
 
-bitmatch-import-c.opt: bitmatch_import_c.cmx
+bitstring-import-c.opt: bitstring_import_c.cmx
        $(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) $(OCAMLOPTLIBS) $< -o $@
 
 test:
@@ -67,9 +67,9 @@ ext3: ext3.cmo
 ext3.cmo: ext3.ml ext3.bmpp
        $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(OCAMLCPACKAGES) $(PP) -c $< -o $@
 
-ext3.bmpp: ext3.c bitmatch-import-c
+ext3.bmpp: ext3.c bitstring-import-c
        rm -f $@.new
-       ./bitmatch-import-c $(DEBUG) $< > $@.new
+       ./bitstring-import-c $(DEBUG) $< > $@.new
        mv $@.new $@
 
 task_struct: task_struct.cmo
@@ -78,17 +78,17 @@ task_struct: task_struct.cmo
 task_struct.cmo: task_struct.ml task_struct.bmpp
        $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(OCAMLCPACKAGES) $(PP) -c $< -o $@
 
-task_struct.bmpp: task_struct.c bitmatch-import-c
+task_struct.bmpp: task_struct.c bitstring-import-c
        cd $(LINUX_HEADERS) && ln -sf asm-x86 asm
        rm -f $@.new
-       ./bitmatch-import-c $(DEBUG) $(LINUX_INCLUDES) $< > $@.new
+       ./bitstring-import-c $(DEBUG) $(LINUX_INCLUDES) $< > $@.new
        mv $@.new $@
 
 # Clean.
 
 clean:
        rm -f core *~ *.cmi *.cmo *.cmx *.cma *.cmxa *.a *.o *.bmpp
-       rm -f bitmatch-import-c bitmatch-import-c.opt
+       rm -f bitstring-import-c bitstring-import-c.opt
 
 distclean: clean
 
@@ -107,7 +107,7 @@ install:
 
 depend: .depend
 
-.depend: bitmatch_import_c.ml
+.depend: bitstring_import_c.ml
        rm -f .depend
        $(OCAMLFIND) ocamldep $(OCAMLCPACKAGES) $^ > $@
 
index 4290b91..52b8a69 100644 (file)
@@ -11,8 +11,8 @@
 #define _Bool unsigned
 #endif
 
-#define BITMATCH_IMPORT(name) __bitmatch_import_##name
-#define BITMATCH_CONSTANT_STRING(name,val) \
-  char *__bitmatch_constant_##name = val
-#define BITMATCH_CONSTANT_INT32(name,val) \
-  int __bitmatch_constant_##name = val
+#define BITSTRING_IMPORT(name) __bitstring_import_##name
+#define BITSTRING_CONSTANT_STRING(name,val) \
+  char *__bitstring_constant_##name = val
+#define BITSTRING_CONSTANT_INT32(name,val) \
+  int __bitstring_constant_##name = val
index 0bf655f..802c009 100644 (file)
@@ -24,7 +24,7 @@ open ExtString
 
 open Cil
 
-module P = Bitmatch_persistent
+module P = Bitstring_persistent
 
 let (//) = Filename.concat
 
@@ -33,7 +33,7 @@ let () =
   let debug = ref false in
   let save_temps = ref false in
   let version () =
-    printf "bitmatch-import-c %s" Bitmatch.version;
+    printf "bitstring-import-c %s" Bitstring.version;
     exit 1
   in
   let cpp_args = ref [] in
@@ -61,14 +61,14 @@ let () =
     match !input_file with
     | None -> input_file := Some str
     | Some _ ->
-       eprintf "bitmatch-import-c: only give a single input file\n";
+       eprintf "bitstring-import-c: only give a single input file\n";
        exit 1
   in
   let usage_msg = "\
 
-bitmatch-import-c: Import C structures and constants and
+bitstring-import-c: Import C structures and constants and
   generate bitmatching functions from them.  Please see the
-  manual page bitmatch-import-c(1) for more information.
+  manual page bitstring-import-c(1) for more information.
 
 OPTIONS" in
 
@@ -80,7 +80,7 @@ OPTIONS" in
     match !input_file with
     | Some f -> f
     | None ->
-       eprintf "bitmatch-import-c: no input file specified\n";
+       eprintf "bitstring-import-c: no input file specified\n";
        exit 1 in
   let cpp_args = List.rev !cpp_args in
 
@@ -101,9 +101,9 @@ OPTIONS" in
     ) in
 
   let cmd =
-    sprintf "cpp %s -I %s -include bitmatch-import-prefix.h %s > %s"
+    sprintf "cpp %s -I %s -include bitstring-import-prefix.h %s > %s"
       (String.concat " " (List.map Filename.quote cpp_args))
-      (Filename.quote (Bitmatch_config.ocamllibdir // "bitmatch"))
+      (Filename.quote (Bitstring_config.ocamllibdir // "bitstring"))
       (Filename.quote input_file) (Filename.quote tmp) in
   if debug then prerr_endline cmd;
   if Sys.command cmd <> 0 then (
@@ -117,7 +117,7 @@ OPTIONS" in
   delete_tmp ();
 
   (* Find out which structures, #defines, etc. are to be imported.
-   * (cf. the macros in bitmatch-import-prefix.h)
+   * (cf. the macros in bitstring-import-prefix.h)
    *)
   let constants =
     List.filter_map (
@@ -125,7 +125,7 @@ OPTIONS" in
       | GVar ({vname = vname; vtype = vtype},
              { init = Some (SingleInit vinit) },
              loc)
-         when String.starts_with vname "__bitmatch_constant_" ->
+         when String.starts_with vname "__bitstring_constant_" ->
          let vname = String.sub vname 20 (String.length vname - 20) in
 
          (* Do constant folding on the initializer and then calculate
@@ -146,7 +146,7 @@ OPTIONS" in
     List.filter_map (
       function
       | GType ({tname = tname; ttype = ttype}, loc)
-         when String.starts_with tname "__bitmatch_import_" ->
+         when String.starts_with tname "__bitstring_import_" ->
          let tname = String.sub tname 18 (String.length tname - 18) in
          Some (tname, ttype, loc)
       | _ -> None
@@ -199,7 +199,7 @@ OPTIONS" in
        *                __attribute__((bitwise)).
        *   ttype    CIL type of struct.
        * Returns:
-       *   pattern  A bitmatch persistent pattern.
+       *   pattern  A bitstring persistent pattern.
        *)
       let rec pattern_of_struct ?(names=[]) ?(offset=NoOffset) ?(endian=None)
          ttype =
@@ -213,9 +213,9 @@ OPTIONS" in
            when hasAttribute "bitwise" attrs ->
            let endian =
              if String.starts_with tname "__le" then
-               Some Bitmatch.LittleEndian
+               Some Bitstring.LittleEndian
              else if String.starts_with tname "__be" then
-               Some Bitmatch.BigEndian
+               Some Bitstring.BigEndian
              else (
                Errormsg.warn "%a: unknown bitwise attribute typename: %s\n"
                  d_loc loc tname;
@@ -316,7 +316,7 @@ OPTIONS" in
        let field =
          match endian with
          | Some endian -> P.set_endian field endian
-         | None -> P.set_endian field Bitmatch.NativeEndian in
+         | None -> P.set_endian field Bitstring.NativeEndian in
 
        field
 
index 1d8672f..c2267e4 100644 (file)
@@ -1,10 +1,10 @@
 /* This is an example import file, showing how to import the ext3
  * superblock automatically from Linux header files.
  *
- * Use: bitmatch-import-c ext3.c > ext3.bmpp
+ * Use: bitstring-import-c ext3.c > ext3.bmpp
  *
  * Tip: Add the --debug flag to that command line to see what's going on.
- * Also use bitmatch-objinfo to examine the bmpp file.
+ * Also use bitstring-objinfo to examine the bmpp file.
  */
 
 /* These are required by Linux in order to get the little/big-endian
@@ -21,6 +21,6 @@
 #include <linux/ext2_fs.h>
 
 /* This tells the importer program what structures and constants to import. */
-//typedef struct ext3_super_block BITMATCH_IMPORT(ext3_super_block);
-typedef struct ext2_super_block BITMATCH_IMPORT(ext3_super_block);
-BITMATCH_CONSTANT_INT32 (ext3_super_magic, EXT3_SUPER_MAGIC);
+//typedef struct ext3_super_block BITSTRING_IMPORT(ext3_super_block);
+typedef struct ext2_super_block BITSTRING_IMPORT(ext3_super_block);
+BITSTRING_CONSTANT_INT32 (ext3_super_magic, EXT3_SUPER_MAGIC);
index 15ebd24..23e9ce3 100644 (file)
@@ -1,7 +1,7 @@
 (* This is an example program using an imported C structure.
  *
  * The C structure is imported from <linux/ext3_fs.h> via "ext3.c"
- * by the bitmatch-import-c program, and saved as "ext3.bmpp".
+ * by the bitstring-import-c program, and saved as "ext3.bmpp".
  *
  * Then we can load "ext3.bmpp" here.
  *)
@@ -12,7 +12,7 @@ open bitmatch "ext3.bmpp"
 
 let () =
   (* Load a real ext3 superblock from the examples directory. *)
-  let bits = Bitmatch.bitstring_of_file "examples/ext3_sb" in
+  let bits = Bitstring.bitstring_of_file "examples/ext3_sb" in
 
   bitmatch bits with
   | { :ext2_super_block } ->
index 51a4c29..c5dbac3 100644 (file)
@@ -1,10 +1,10 @@
 /* This is an example import file, showing how to import the
  * Linux task_struct structure from header files.
  *
- * Use: bitmatch-import-c task_struct.c > task_struct.ml
+ * Use: bitstring-import-c task_struct.c > task_struct.ml
  *
  * Tip: Add the --debug flag to that command line to see what's going on.
- * Also use bitmatch-objinfo to examine the bmpp file.
+ * Also use bitstring-objinfo to examine the bmpp file.
  */
 
 /* Any defines, etc. necessary to get the include to work. */
@@ -23,4 +23,4 @@
 #include "linux/sched.h"
 
 /* This tells the importer program what structures and constants to import. */
-typedef struct task_struct BITMATCH_IMPORT(task_struct);
+typedef struct task_struct BITSTRING_IMPORT(task_struct);
index 763c718..db0596e 100644 (file)
@@ -1,7 +1,7 @@
 (* This is an example program using an imported C structure.
  *
  * The Linux process table entry structure is imported from
- * <linux/sched.h> via "task_struct.c" by the bitmatch-import-c
+ * <linux/sched.h> via "task_struct.c" by the bitstring-import-c
  * program, and saved as "task_struct.bmpp".
  *
  * Then we can load "task_struct.bmpp" here.
@@ -13,5 +13,5 @@ open bitmatch "task_struct.bmpp"
 
 (*
 let () =
-  let bits = Bitmatch.bitstring_of_file "examples/ext3_sb" in
+  let bits = Bitstring.bitstring_of_file "examples/ext3_sb" in
 *)
index 3672575..36b6d26 100644 (file)
@@ -1,4 +1,4 @@
-# Bitmatch syntax extension.
+# Bitstring syntax extension.
 # Copyright (C) 2008 Red Hat Inc., Richard W.M. Jones
 #
 # This library is free software; you can redistribute it and/or
@@ -17,7 +17,7 @@
 
 dnl Process this file with autoconf to produce a configure script.
 
-AC_INIT(ocaml-bitmatch,1.9.6)
+AC_INIT(ocaml-bitstring,1.9.7)
 
 dnl Check for basic C environment.
 AC_PROG_CC
@@ -61,5 +61,5 @@ AC_SUBST(pkg_cil)
 
 dnl Produce output files.
 AC_CONFIG_HEADERS([config.h])
-AC_CONFIG_FILES([Makefile META bitmatch_config.ml cil-tools/Makefile])
+AC_CONFIG_FILES([Makefile META bitstring_config.ml cil-tools/Makefile])
 AC_OUTPUT
index 021dbfa..291bcb8 100644 (file)
@@ -2,7 +2,7 @@
  * $Id$
  *)
 
-open Bitmatch_persistent
+open Bitstring_persistent
 
 open Camlp4.PreCast
 open Syntax
index f8bf341..67431be 100644 (file)
@@ -6,7 +6,7 @@ open Printf
 
 let () =
   let filename = "/bin/ls" in
-  let bits = Bitmatch.bitstring_of_file filename in
+  let bits = Bitstring.bitstring_of_file filename in
 
   bitmatch bits with
   | { 0x7f : 8; "ELF" : 24 : string;   (* ELF magic number *)
index 8be2606..77ef2db 100644 (file)
@@ -4,9 +4,9 @@
 
 open Printf
 
-(*let () = Bitmatch.debug := true*)
+(*let () = Bitstring.debug := true*)
 
-let bits = Bitmatch.bitstring_of_file "ext3_sb"
+let bits = Bitstring.bitstring_of_file "ext3_sb"
 
 (* The structure is straight from /usr/include/linux/ext3_fs.h *)
 
index 050a9c8..cbfa928 100644 (file)
@@ -8,7 +8,7 @@ let () =
   if Array.length Sys.argv <= 1 then
     failwith "usage: gif input.gif";
   let filename = Sys.argv.(1) in
-  let bits = Bitmatch.bitstring_of_file filename in
+  let bits = Bitstring.bitstring_of_file filename in
 
   bitmatch bits with
   | { ("GIF87a"|"GIF89a") : 6*8 : string; (* GIF magic. *)
index 6db81ad..e47de03 100644 (file)
@@ -4,7 +4,7 @@
 
 open Printf
 
-let header = Bitmatch.bitstring_of_file "ipv4_header.dat"
+let header = Bitstring.bitstring_of_file "ipv4_header.dat"
 
 let () =
   bitmatch header with
@@ -29,13 +29,13 @@ let () =
     printf "  checksum: %d\n" checksum;
     printf "  source: %lx  dest: %lx\n" source dest;
     printf "  header options + padding:\n";
-    Bitmatch.hexdump_bitstring stdout options;
+    Bitstring.hexdump_bitstring stdout options;
     printf "  packet payload:\n";
-    Bitmatch.hexdump_bitstring stdout payload
+    Bitstring.hexdump_bitstring stdout payload
 
   | { version : 4 } ->
     eprintf "cannot parse IP version %d\n" version
 
   | { _ } as header ->
     eprintf "data is smaller than one nibble:\n";
-    Bitmatch.hexdump_bitstring stderr header
+    Bitstring.hexdump_bitstring stderr header
index 229f6bc..e7fdd93 100644 (file)
@@ -16,7 +16,7 @@ open Printf
 
 let rec main () =
   if Array.length Sys.argv <= 1 then failwith "libpcap dumpfile";
-  let bits = Bitmatch.bitstring_of_file Sys.argv.(1) in
+  let bits = Bitstring.bitstring_of_file Sys.argv.(1) in
   let endian, file_header, bits = libpcap_header bits in
 
   (* Read the packets and print them out. *)
@@ -31,8 +31,8 @@ let rec main () =
 
 (* Determine the endianness (at runtime) from the magic number. *)
 and endian_of = function
-  | 0xa1b2c3d4_l -> Bitmatch.BigEndian
-  | 0xd4c3b2a1_l -> Bitmatch.LittleEndian
+  | 0xa1b2c3d4_l -> Bitstring.BigEndian
+  | 0xd4c3b2a1_l -> Bitstring.LittleEndian
   | _ -> assert false
 
 and libpcap_header bits =
@@ -102,11 +102,11 @@ and decode_and_print_packet file_header pkt_header pkt_data =
            printf "IPv6 ";
 
        | { _ } ->
-           printf "\n"; Bitmatch.hexdump_bitstring stdout packet
+           printf "\n"; Bitstring.hexdump_bitstring stdout packet
        )
 
    | { _ } ->
-       printf "\n"; Bitmatch.hexdump_bitstring stdout pkt_data
+       printf "\n"; Bitstring.hexdump_bitstring stdout pkt_data
   );
   printf "\n"
 
index 5b3463d..225eae3 100644 (file)
@@ -16,9 +16,9 @@ let protocol = 17                     (* UDP *)
 let checksum = 0
 let source = 0xc0a80202_l              (* 192.168.2.2 *)
 let dest = 0xc0a80201_l                        (* 192.168.2.1 *)
-let options = Bitmatch.empty_bitstring
+let options = Bitstring.empty_bitstring
 let payload_length = (length - hdrlen*4) * 8
-let payload = Bitmatch.create_bitstring payload_length
+let payload = Bitstring.create_bitstring payload_length
 
 let header =
   BITSTRING {
@@ -34,4 +34,4 @@ let header =
 *)
   }
 
-let () = Bitmatch.bitstring_to_file header "ipv4_header_out.dat"
+let () = Bitstring.bitstring_to_file header "ipv4_header_out.dat"
index 6d53077..6112364 100644 (file)
@@ -27,9 +27,9 @@ let display pkt =
     printf "  checksum: %d\n" checksum;
     printf "  source: %lx  dest: %lx\n" source dest;
     printf "  header options + padding:\n";
-    Bitmatch.hexdump_bitstring stdout options;
+    Bitstring.hexdump_bitstring stdout options;
     printf "  packet payload:\n";
-    Bitmatch.hexdump_bitstring stdout payload
+    Bitstring.hexdump_bitstring stdout payload
 
   (* IPv6 packet header *)
   | { 6 : 4; tclass : 8; flow : 20;
@@ -45,11 +45,11 @@ let display pkt =
     printf "  next header: %d\n" nexthdr;
     printf "  ttl: %d\n" ttl;
     printf "  source address:\n";
-    Bitmatch.hexdump_bitstring stdout source;
+    Bitstring.hexdump_bitstring stdout source;
     printf "  destination address:\n";
-    Bitmatch.hexdump_bitstring stdout dest;
+    Bitstring.hexdump_bitstring stdout dest;
     printf "packet payload:\n";
-    Bitmatch.hexdump_bitstring stdout payload
+    Bitstring.hexdump_bitstring stdout payload
 
   | { version : 4 } ->
     eprintf "unknown IP version %d\n" version;
@@ -57,11 +57,11 @@ let display pkt =
 
   | { _ } as pkt ->
     eprintf "data is smaller than one nibble:\n";
-    Bitmatch.hexdump_bitstring stderr pkt;
+    Bitstring.hexdump_bitstring stderr pkt;
     exit 1
 
 let () =
-  let pkt = Bitmatch.bitstring_of_file "ping.ipv4" in
+  let pkt = Bitstring.bitstring_of_file "ping.ipv4" in
   display pkt;
-  let pkt = Bitmatch.bitstring_of_file "ping.ipv6" in
+  let pkt = Bitstring.bitstring_of_file "ping.ipv6" in
   display pkt
index d7f28ff..664e62d 100644 (file)
@@ -1,4 +1,4 @@
-(* Bitmatch syntax extension.
+(* Bitstring syntax extension.
  * Copyright (C) 2008 Red Hat Inc., Richard W.M. Jones
  *
  * This library is free software; you can redistribute it and/or
@@ -25,12 +25,12 @@ open Camlp4.PreCast
 open Syntax
 open Ast
 
-open Bitmatch
-module P = Bitmatch_persistent
+open Bitstring
+module P = Bitstring_persistent
 
 (* If this is true then we emit some debugging code which can
  * be useful to tell what is happening during matches.  You
- * also need to do 'Bitmatch.debug := true' in your main program.
+ * also need to do 'Bitstring.debug := true' in your main program.
  *
  * If this is false then no extra debugging code is emitted.
  *)
@@ -67,7 +67,7 @@ let gensym =
   let i = ref 1000 in
   fun name ->
     incr i; let i = !i in
-    sprintf "__pabitmatch_%s_%d" name i
+    sprintf "__pabitstring_%s_%d" name i
 
 (* Used to keep track of which qualifiers we've seen in parse_field. *)
 type whatset_t = {
@@ -123,7 +123,7 @@ let parse_field _loc field qs =
                match expr with
                | <:expr< $lid:id$ >> -> id
                | _ ->
-                   failwith "pa_bitmatch: internal error: save_offset_to only supports simple identifiers at the moment.  In future we should support full patterns." in
+                   failwith "pa_bitstring: internal error: save_offset_to only supports simple identifiers at the moment.  In future we should support full patterns." in
              let field = P.set_save_offset_to_lident field id in
              { whatset with save_offset_to_set = true }, field
          | "save_offset_to", None ->
@@ -174,16 +174,16 @@ let parse_field _loc field qs =
   field
 
 (* Choose the right constructor function. *)
-let build_bitmatch_call _loc funcname length endian signed =
+let build_bitstring_call _loc funcname length endian signed =
   match length, endian, signed with
     (* XXX The meaning of signed/unsigned breaks down at
      * 31, 32, 63 and 64 bits.
      *)
-  | (Some 1, _, _) -> <:expr< Bitmatch.$lid:funcname ^ "_bit"$ >>
+  | (Some 1, _, _) -> <:expr< Bitstring.$lid:funcname ^ "_bit"$ >>
   | (Some (2|3|4|5|6|7|8), _, sign) ->
       let call = Printf.sprintf "%s_char_%s"
         funcname (if sign then "signed" else "unsigned") in
-      <:expr< Bitmatch.$lid:call$ >>
+      <:expr< Bitstring.$lid:call$ >>
   | (len, endian, signed) ->
       let t = match len with
       | Some i when i <= 31 -> "int"
@@ -198,21 +198,21 @@ let build_bitmatch_call _loc funcname length endian signed =
           | NativeEndian -> "ne" in
           let call = Printf.sprintf "%s_%s_%s_%s"
             funcname t endianness sign in
-          <:expr< Bitmatch.$lid:call$ >>
+          <:expr< Bitstring.$lid:call$ >>
       | P.EndianExpr expr ->
           let call = Printf.sprintf "%s_%s_%s_%s"
             funcname t "ee" sign in
-          <:expr< Bitmatch.$lid:call$ $expr$ >>
+          <:expr< Bitstring.$lid:call$ $expr$ >>
 
 (* Generate the code for a constructor, ie. 'BITSTRING ...'. *)
 let output_constructor _loc fields =
-  (* This function makes code to raise a Bitmatch.Construct_failure exception
+  (* This function makes code to raise a Bitstring.Construct_failure exception
    * containing a message and the current _loc context.
    * (Thanks to Bluestorm for suggesting this).
    *)
   let construct_failure _loc msg =
     <:expr<
-      Bitmatch.Construct_failure
+      Bitstring.Construct_failure
         ($`str:msg$,
         $`str:Loc.file_name _loc$,
         $`int:Loc.start_line _loc$,
@@ -271,9 +271,9 @@ let output_constructor _loc fields =
       let flen_is_const = expr_is_constant flen in
 
       let int_construct_const (i, endian, signed) =
-        build_bitmatch_call _loc "construct" (Some i) endian signed in
+        build_bitstring_call _loc "construct" (Some i) endian signed in
       let int_construct (endian, signed) =
-       build_bitmatch_call _loc "construct" None endian signed in
+       build_bitstring_call _loc "construct" None endian signed in
 
       let expr =
        match t, flen_is_const with
@@ -319,7 +319,7 @@ let output_constructor _loc fields =
            <:expr<
              let $lid:bs$ = $fexpr$ in
              if String.length $lid:bs$ = $`int:j$ then
-               Bitmatch.construct_string $lid:buffer$ $lid:bs$
+               Bitstring.construct_string $lid:buffer$ $lid:bs$
              else
                $raise_construct_failure _loc "length of string does not match declaration"$
            >>
@@ -328,7 +328,7 @@ let output_constructor _loc fields =
         * with no checks.
         *)
        | P.String, Some (-1) ->
-           <:expr< Bitmatch.construct_string $lid:buffer$ $fexpr$ >>
+           <:expr< Bitstring.construct_string $lid:buffer$ $fexpr$ >>
 
        (* String, constant length = 0 is probably an error, and so is
         * any other value.
@@ -349,7 +349,7 @@ let output_constructor _loc fields =
                if $lid:bslen$ land 7 = 0 then (
                  let $lid:bs$ = $fexpr$ in
                  if String.length $lid:bs$ = ($lid:bslen$ lsr 3) then
-                   Bitmatch.construct_string $lid:buffer$ $lid:bs$
+                   Bitstring.construct_string $lid:buffer$ $lid:bs$
                  else
                    $raise_construct_failure _loc "length of string does not match declaration"$
                ) else
@@ -363,8 +363,8 @@ let output_constructor _loc fields =
            let bs = gensym "bs" in
            <:expr<
              let $lid:bs$ = $fexpr$ in
-             if Bitmatch.bitstring_length $lid:bs$ = $`int:i$ then
-               Bitmatch.construct_bitstring $lid:buffer$ $lid:bs$
+             if Bitstring.bitstring_length $lid:bs$ = $`int:i$ then
+               Bitstring.construct_bitstring $lid:buffer$ $lid:bs$
              else
                $raise_construct_failure _loc "length of bitstring does not match declaration"$
            >>
@@ -373,7 +373,7 @@ let output_constructor _loc fields =
         * with no checks.
         *)
        | P.Bitstring, Some (-1) ->
-           <:expr< Bitmatch.construct_bitstring $lid:buffer$ $fexpr$ >>
+           <:expr< Bitstring.construct_bitstring $lid:buffer$ $fexpr$ >>
 
        (* Bitstring, constant length < -1 is an error. *)
        | P.Bitstring, Some _ ->
@@ -390,8 +390,8 @@ let output_constructor _loc fields =
              let $lid:bslen$ = $flen$ in
              if $lid:bslen$ >= 0 then (
                let $lid:bs$ = $fexpr$ in
-               if Bitmatch.bitstring_length $lid:bs$ = $lid:bslen$ then
-                 Bitmatch.construct_bitstring $lid:buffer$ $lid:bs$
+               if Bitstring.bitstring_length $lid:bs$ = $lid:bslen$ then
+                 Bitstring.construct_bitstring $lid:buffer$ $lid:bs$
                else
                  $raise_construct_failure _loc "length of bitstring does not match declaration"$
              ) else
@@ -415,9 +415,9 @@ let output_constructor _loc fields =
 
   let expr =
     <:expr<
-      let $lid:buffer$ = Bitmatch.Buffer.create () in
+      let $lid:buffer$ = Bitstring.Buffer.create () in
       $fields$;
-      Bitmatch.Buffer.contents $lid:buffer$
+      Bitstring.Buffer.contents $lid:buffer$
     >> in
 
   if !exn_used then
@@ -506,9 +506,9 @@ let output_bitmatch _loc bs cases =
 
        (* Now build the code which matches a field. *)
        let int_extract_const (i, endian, signed) =
-          build_bitmatch_call _loc "extract" (Some i) endian signed in
+          build_bitstring_call _loc "extract" (Some i) endian signed in
        let int_extract (endian, signed) =
-         build_bitmatch_call _loc "extract" None endian signed in
+         build_bitstring_call _loc "extract" None endian signed in
 
        let expr =
          match t, flen_is_const with
@@ -548,9 +548,9 @@ let output_bitmatch _loc bs cases =
              <:expr<
                if $lid:len$ >= $`int:i$ then (
                  let $lid:bs$, $lid:off$, $lid:len$ =
-                   Bitmatch.extract_bitstring $lid:data$ $lid:off$ $lid:len$
+                   Bitstring.extract_bitstring $lid:data$ $lid:off$ $lid:len$
                      $`int:i$ in
-                 match Bitmatch.string_of_bitstring $lid:bs$ with
+                 match Bitstring.string_of_bitstring $lid:bs$ with
                  | $fpatt$ when true -> $expr$
                  | _ -> ()
                )
@@ -563,8 +563,8 @@ let output_bitmatch _loc bs cases =
              let bs = gensym "bs" in
              <:expr<
                let $lid:bs$, $lid:off$, $lid:len$ =
-                 Bitmatch.extract_remainder $lid:data$ $lid:off$ $lid:len$ in
-               match Bitmatch.string_of_bitstring $lid:bs$ with
+                 Bitstring.extract_remainder $lid:data$ $lid:off$ $lid:len$ in
+               match Bitstring.string_of_bitstring $lid:bs$ with
                | $fpatt$ when true -> $expr$
                | _ -> ()
              >>
@@ -581,9 +581,9 @@ let output_bitmatch _loc bs cases =
                if $flen$ >= 0 && $flen$ <= $lid:len$
                  && $flen$ land 7 = 0 then (
                    let $lid:bs$, $lid:off$, $lid:len$ =
-                     Bitmatch.extract_bitstring
+                     Bitstring.extract_bitstring
                        $lid:data$ $lid:off$ $lid:len$ $flen$ in
-                   match Bitmatch.string_of_bitstring $lid:bs$ with
+                   match Bitstring.string_of_bitstring $lid:bs$ with
                    | $fpatt$ when true -> $expr$
                    | _ -> ()
                  )
@@ -603,7 +603,7 @@ let output_bitmatch _loc bs cases =
              <:expr<
                if $lid:len$ >= $`int:i$ then (
                  let $lid:ident$, $lid:off$, $lid:len$ =
-                   Bitmatch.extract_bitstring $lid:data$ $lid:off$ $lid:len$
+                   Bitstring.extract_bitstring $lid:data$ $lid:off$ $lid:len$
                      $`int:i$ in
                  $expr$
                )
@@ -621,7 +621,7 @@ let output_bitmatch _loc bs cases =
                    fail "cannot compare a bitstring to a constant" in
              <:expr<
                let $lid:ident$, $lid:off$, $lid:len$ =
-                 Bitmatch.extract_remainder $lid:data$ $lid:off$ $lid:len$ in
+                 Bitstring.extract_remainder $lid:data$ $lid:off$ $lid:len$ in
                  $expr$
              >>
 
@@ -641,7 +641,7 @@ let output_bitmatch _loc bs cases =
              <:expr<
                if $flen$ >= 0 && $flen$ <= $lid:len$ then (
                  let $lid:ident$, $lid:off$, $lid:len$ =
-                   Bitmatch.extract_bitstring $lid:data$ $lid:off$ $lid:len$
+                   Bitstring.extract_bitstring $lid:data$ $lid:off$ $lid:len$
                      $flen$ in
                  $expr$
                )
@@ -779,11 +779,11 @@ let output_bitmatch _loc bs cases =
            let field = P.string_of_pattern_field field in
 
            <:expr<
-             if !Bitmatch.debug then (
-               Printf.eprintf "PA_BITMATCH: TEST:\n";
+             if !Bitstring.debug then (
+               Printf.eprintf "PA_BITSTRING: TEST:\n";
                Printf.eprintf "  %s\n" $str:field$;
                Printf.eprintf "  off %d len %d\n%!" $lid:off$ $lid:len$;
-               (*Bitmatch.hexdump_bitstring stderr
+               (*Bitstring.hexdump_bitstring stderr
                  ($lid:data$,$lid:off$,$lid:len$);*)
              );
              $expr$
@@ -865,7 +865,7 @@ let expand_named_pattern _loc name =
     locfail _loc (sprintf "named pattern not found: %s" name)
 
 (* Add named patterns from a file.  See the documentation on the
- * directory search path in bitmatch_persistent.mli
+ * directory search path in bitstring_persistent.mli
  *)
 let load_patterns_from_file _loc filename =
   let chan =
@@ -874,7 +874,7 @@ let load_patterns_from_file _loc filename =
       try open_in filename
       with _ ->
        (* Try OCaml library directory. *)
-       try open_in (Filename.concat Bitmatch_config.ocamllibdir filename)
+       try open_in (Filename.concat Bitstring_config.ocamllibdir filename)
        with exn -> Loc.raise _loc exn
     ) else (
       try open_in filename
index c4160ab..653b70a 100644 (file)
@@ -2,4 +2,4 @@
  * $Id$
  *)
 
-let _ = Bitmatch.extract_bit
+let _ = Bitstring.extract_bit
index 8cc06c5..ae0e331 100644 (file)
@@ -3,5 +3,5 @@
  *)
 
 let () =
-  let bits = Bitmatch.create_bitstring 16 in
-  ignore (Bitmatch.string_of_bitstring bits)
+  let bits = Bitstring.create_bitstring 16 in
+  ignore (Bitstring.string_of_bitstring bits)
index 90a7a08..f0dde30 100644 (file)
@@ -17,9 +17,9 @@ let () =
     (* Create a random string of bits. *)
     let expected = List.map (fun _ -> Random.bool ()) (range 0 (len-1)) in
 
-    let bits = Bitmatch.Buffer.create () in
-    List.iter (Bitmatch.Buffer.add_bit bits) expected;
-    let bits = Bitmatch.Buffer.contents bits in
+    let bits = Bitstring.Buffer.create () in
+    List.iter (Bitstring.Buffer.add_bit bits) expected;
+    let bits = Bitstring.Buffer.contents bits in
 
     (* Now read the bitstring in groups of 1, 2, 3 .. etc. bits.
      * In each case check the result against what we generated ('expected').
index e8f54b9..c9ffd1a 100644 (file)
@@ -21,12 +21,12 @@ let () =
                    Random.int64 (Int64.sub (Int64.shift_left 1L bitlen) 1L))
          (range 0 (len-1)) in
 
-      let bits = Bitmatch.Buffer.create () in
+      let bits = Bitstring.Buffer.create () in
       List.iter (fun i ->
-                  Bitmatch.construct_int64_be_unsigned bits i bitlen
+                  Bitstring.construct_int64_be_unsigned bits i bitlen
                     (Failure "constructing string"))
        expected;
-      let bits = Bitmatch.Buffer.contents bits in
+      let bits = Bitstring.Buffer.contents bits in
 
       (* Now read the bitstring as integers.
        * In each case check the result against what we generated ('expected').
@@ -35,7 +35,7 @@ let () =
        let rec loop bits =
          bitmatch bits with
          | { i : bitlen; rest : -1 : bitstring }
-             when Bitmatch.bitstring_length rest = 0 -> [i]
+             when Bitstring.bitstring_length rest = 0 -> [i]
          | { i : bitlen; rest : -1 : bitstring } -> i :: loop rest
          | { _ } ->
              failwith (sprintf "loop failed with len = %d, bitlen = %d"
index 7d49292..1014bcb 100644 (file)
@@ -7,7 +7,7 @@ open Printf
 let nr_passes = 10000
 let max_size = 8                       (* max field size in bits *)
 
-(* let () = Bitmatch.debug := true *)
+(* let () = Bitstring.debug := true *)
 
 (* Return a full 64 bits of randomness. *)
 let rand64 () =
@@ -36,8 +36,8 @@ let dump n0 n0sz n1 n1sz n2 n2sz n3 n3sz bits r0 r1 r2 r3 =
   eprintf "  1: %3d - %016Lx - %016Lx\n" n1sz n1 r1;
   eprintf "  2: %3d - %016Lx - %016Lx\n" n2sz n2 r2;
   eprintf "  3: %3d - %016Lx - %016Lx\n" n3sz n3 r3;
-  eprintf "bits (length = %d):\n" (Bitmatch.bitstring_length bits);
-  Bitmatch.hexdump_bitstring stderr bits;
+  eprintf "bits (length = %d):\n" (Bitstring.bitstring_length bits);
+  Bitstring.hexdump_bitstring stderr bits;
   eprintf "%!"
 
 let () =
@@ -63,16 +63,16 @@ let () =
           n3 : n3sz
         })
       with
-       Bitmatch.Construct_failure (msg, _, _, _) ->
+       Bitstring.Construct_failure (msg, _, _, _) ->
          eprintf "FAILED: Construct_failure %s\n%!" msg;
          dump n0 n0sz n1 n1sz n2 n2sz n3 n3sz
-           (Bitmatch.empty_bitstring) 0L 0L 0L 0L;
+           (Bitstring.empty_bitstring) 0L 0L 0L 0L;
          exit 2 in
 
     let r0, r1, r2, r3 =
       bitmatch bits with
       | { r0 : n0sz; r1 : n1sz; r2 : n2sz; r3 : n3sz; rest : -1 : bitstring } ->
-         let rest_len = Bitmatch.bitstring_length rest in
+         let rest_len = Bitstring.bitstring_length rest in
           if rest_len <> 0 then (
            eprintf "FAILED: rest is not zero length (length = %d)\n%!"
              rest_len;
index e9a95f9..466a8f2 100644 (file)
@@ -1,4 +1,4 @@
-(* Test the Bitmatch.Buffer module and string_of_bitstring in
+(* Test the Bitstring.Buffer module and string_of_bitstring in
  * nasty non-aligned corner cases.
  * $Id$
  *)
@@ -31,20 +31,20 @@ let () =
        *                <---------------- len bits --------------->
        *)
       let bits =
-       let bits = Bitmatch.Buffer.create () in
-       Bitmatch.Buffer.add_bits bits str1 offset;
-       Bitmatch.Buffer.add_bits bits expected len;
-       Bitmatch.Buffer.contents bits in
+       let bits = Bitstring.Buffer.create () in
+       Bitstring.Buffer.add_bits bits str1 offset;
+       Bitstring.Buffer.add_bits bits expected len;
+       Bitstring.Buffer.contents bits in
 
       (* Create a sub bitstring corresponding to what we want to check. *)
       let subbits =
        let bits, bitoffset, bitlen = bits in
        (bits, bitoffset+offset, bitlen-offset) in
 
-      assert (Bitmatch.bitstring_length subbits = len);
+      assert (Bitstring.bitstring_length subbits = len);
 
       (* Now try to read out the substring using string_of_bitstring. *)
-      let actual = Bitmatch.string_of_bitstring subbits in
+      let actual = Bitstring.string_of_bitstring subbits in
       if actual <> expected then (
        eprintf "MISMATCH between actual and expected, offset=%d, len=%d\n"
          offset len;
@@ -57,9 +57,9 @@ let () =
          eprintf " %02x" (Char.code actual.[i])
        done;
        eprintf "\nBITS:\n";
-       Bitmatch.hexdump_bitstring stderr bits;
+       Bitstring.hexdump_bitstring stderr bits;
        eprintf "SUBBITS:\n";
-       Bitmatch.hexdump_bitstring stderr subbits;
+       Bitstring.hexdump_bitstring stderr subbits;
        exit 1
       );
     done
index 2ebc55b..6dd4a7f 100644 (file)
@@ -3,7 +3,7 @@
  *)
 
 open Printf
-open Bitmatch
+open Bitstring
 
 let () =
   let rec loop = function
index 6feee33..c14bebb 100644 (file)
@@ -3,7 +3,7 @@
  *)
 
 open Printf
-open Bitmatch
+open Bitstring
 
 (* A byte+length Pascal string. *)
 let bitmatch pascal_string =
index 3e05005..8c0b33b 100644 (file)
@@ -3,7 +3,7 @@
  *)
 
 open Printf
-open Bitmatch
+open Bitstring
 
 open bitmatch "tests/test.bmpp"
 
index 9e683b0..a2b00ca 100644 (file)
@@ -3,7 +3,7 @@
  *)
 
 open Printf
-open Bitmatch
+open Bitstring
 
 let make_bits i n j m k = (
   let pad1 = ones_bitstring (n-8) in
index a75d80a..1ea7f70 100644 (file)
@@ -4,7 +4,7 @@
  *)
 
 open Printf
-open Bitmatch
+open Bitstring
 
 let make_bits si n sj m sk = (
   let pad1 = ones_bitstring (n-64) in
index dafb00e..3276965 100644 (file)
@@ -3,7 +3,7 @@
  *)
 
 open Printf
-open Bitmatch
+open Bitstring
 
 let make_bits p i n j m k = (
   let pad0 = ones_bitstring p in
index 27c17e4..b731a5f 100644 (file)
@@ -3,7 +3,7 @@
  *)
 
 open Printf
-open Bitmatch
+open Bitstring
 
 let make_bits p i n j m k = (
   let pad0 = ones_bitstring p in
index 88685ac..a63ee6b 100644 (file)
@@ -3,7 +3,7 @@
  *)
 
 open Printf
-open Bitmatch
+open Bitstring
 
 let bits = (BITSTRING { 101 : 16; 202 : 16 })