From: Richard W.M. Jones Date: Thu, 17 Jul 2008 08:55:00 +0000 (+0000) Subject: Added when(), bind() and save_offset_to() to the TODO list. X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=67663c5053cd076b43508ab7ed0720090f3de201;p=ocaml-bitstring.git Added when(), bind() and save_offset_to() to the TODO list. --- diff --git a/TODO b/TODO index a3c5981..9cc63b3 100644 --- a/TODO +++ b/TODO @@ -63,4 +63,38 @@ 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) Fix the META file. Current one is very broken. +(17) PARTLY DONE - Fix the META file. Current one is very broken. + +(18) when() qualifier: + + { field : 16 : when (field > 100) } + + The when(expr) qualifier will abort the rest of the match if the + expression is false. + +(19) 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) 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.