X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=TODO;h=ff2a556127c76740e70bece890946b6003212739;hb=5997a66d9b078d75f821eedc9ba615c9df321e98;hp=2883562db370073eb664f4bb5d74490ff3835eea;hpb=adc39fc130b77da467a69c668dc7af9efdc1d9e3;p=ocaml-bitstring.git diff --git a/TODO b/TODO index 2883562..ff2a556 100644 --- a/TODO +++ b/TODO @@ -33,7 +33,7 @@ Major to-do items. Make the error locations fine-grained, particularly so they point to individual fields, not the whole match. -(10) Cross-module, persistent, named patterns, see: +(10) DONE - Cross-module, persistent, named patterns, see: http://caml.inria.fr/pub/ml-archives/caml-list/2008/04/25992c9c9fa999fe1d35d961dd9917a2.en.html (11) DONE - @@ -49,7 +49,7 @@ Major to-do items. (12) DONE - More constant field lengths. -(13) Implement native endian functions. +(13) PARTLY DONE - Implement native endian functions. (14) PARTLY DONE - A proper test suite. @@ -63,3 +63,74 @@ Major to-do items. of functions to be called (at compile time). However do note that the offset in the bitstring is usually not known. +(17) PARTLY DONE - Fix the META file. Current one is very broken. + +(18) DONE - check() qualifier: + + { field : 16 : check (field > 100) } + + The check(expr) qualifier will abort the rest of the match if the + expression is false. + +(19) DONE - bind() qualifier: + + { field : 16 : bind (field * 3) } + ^pattern ^new value + + The bind(expr) qualifier binds the pattern to a new value, + equivalent to doing: + + let field = field * 3 in + (* remainder of match *) + + There is a question of whether bind() should run before or + after when() [best is probably when() first, then bind()]. + +(20) DONE - save_offset_to() qualifier: + + { field : 16 : save_offset_to (offset), bind (field - offset) } + + or: + + { field : 16 : save_offset_to (field_offset) } -> + printf "the offset of field (%d) is %d\n" field field_offset + + save_offset_to(patt) binds the current match offset to + the variable, for later use within bind(), when() or + any later parts of the match. + +(21) derive() so you can add your own variable decls: + + { field : 32 : derive (field_as_int, Int32.to_int field) } + + This would add a let derivation, equivalent to: + + let field_as_int = Int32.to_int field + + allowing you to use both the original field and field_as_int + as variables. + + Note you can do this clumsily using bind(): + + { field : 32 : bind (field, Int32.to_int field) } + + which redefines 'field' as a pair of (old value, derived value). + +(22) Allow constant 0 to be used in constructors to mean a zero-length + bitstring of the right length, eg: + + BITSTRING { 0 : 32*8 : bitstring } + + which would be equivalent to: + + BITSTRING { zeroes_bitstring (32*8) : 32*8 : bitstring } + +(23) Add predicate Bitstring.is_zero_bitstring : bitstring -> bool + +(24) Add a function to turn bitstrings into printable strings. + +(25) Folding over bitstrings. A narrow usage for this is to generate + checksums and hashes, where usually you want to fold over every + 8/16/32-bit word. So a set of functions which just enabled this + would be useful. (However you still need le/be/ne variations so + it involves at least 7 functions).