Added construct_string, version 0.7 for release.
authorRichard W.M. Jones <rich@annexia.org>
Wed, 7 May 2008 14:37:00 +0000 (14:37 +0000)
committerRichard W.M. Jones <rich@annexia.org>
Wed, 7 May 2008 14:37:00 +0000 (14:37 +0000)
TODO
bitmatch.ml
bitmatch.mli
configure.ac

diff --git a/TODO b/TODO
index 470f51c..10ea7a9 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,4 +1,4 @@
-$Id: TODO,v 1.4 2008-04-25 12:55:39 rjones Exp $
+$Id: TODO,v 1.5 2008-05-07 14:37:00 rjones Exp $
 Major to-do items.
 
 (1) DONE - In bitmatch operator, use patterns not expressions.
@@ -32,3 +32,6 @@ Major to-do items.
 (9) DONE -
     Make the error locations fine-grained, particularly so they point to
     individual fields, not the whole match.
+
+(10) Cross-module, persistent, named patterns, see:
+  http://caml.inria.fr/pub/ml-archives/caml-list/2008/04/25992c9c9fa999fe1d35d961dd9917a2.en.html
index 1b98c57..ff537bf 100644 (file)
@@ -15,7 +15,7 @@
  * 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: bitmatch.ml,v 1.10 2008-04-26 20:35:02 rjones Exp $
+ * $Id: bitmatch.ml,v 1.11 2008-05-07 14:37:00 rjones Exp $
  *)
 
 open Printf
@@ -650,6 +650,13 @@ let construct_int64_be_unsigned buf v flen exn =
   (* Add the bytes. *)
   I64.map_bytes_be (Buffer._add_bits buf) (Buffer.add_byte buf) v flen
 
+(* Construct from a string of bytes, exact multiple of 8 bits
+ * in length of course.
+ *)
+let construct_string buf str =
+  let len = String.length str in
+  Buffer.add_bits buf str (len lsl 3)
+
 (*----------------------------------------------------------------------*)
 (* Extract a string from a bitstring. *)
 
index aee63e2..e237ca7 100644 (file)
@@ -15,7 +15,7 @@
  * 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: bitmatch.mli,v 1.17 2008-04-26 20:35:02 rjones Exp $
+ * $Id: bitmatch.mli,v 1.18 2008-05-07 14:37:00 rjones Exp $
  *)
 
 (**
@@ -692,3 +692,5 @@ val construct_char_unsigned : Buffer.t -> int -> int -> exn -> unit
 val construct_int_be_unsigned : Buffer.t -> int -> int -> exn -> unit
 
 val construct_int64_be_unsigned : Buffer.t -> int64 -> int -> exn -> unit
+
+val construct_string : Buffer.t -> string -> unit
index 0c73b38..182c2d4 100644 (file)
@@ -17,7 +17,7 @@
 
 dnl Process this file with autoconf to produce a configure script.
 
-AC_INIT(ocaml-bitmatch,0.6)
+AC_INIT(ocaml-bitmatch,0.7)
 
 dnl Check for basic C environment.
 AC_PROG_CC