File: TODO

package info (click to toggle)
ocaml-bitstring 2.0.4-2
  • links: PTS, VCS
  • area: main
  • in suites: buster, jessie, jessie-kfreebsd, sid, stretch
  • size: 1,516 kB
  • ctags: 546
  • sloc: ml: 3,470; sh: 343; makefile: 335; ansic: 114
file content (136 lines) | stat: -rw-r--r-- 4,058 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
$Id: TODO 186 2010-02-05 14:01:53Z richard.wm.jones $
Major to-do items.

(1) DONE - In bitmatch operator, use patterns not expressions.

(2) DONE - Allow matching against strings.

(3) DONE - Change the syntax so { ... } surrounds match patterns.

(4) Provide UInt32 and UInt64 types.

(5) DONE - Allow for specific offsets and alignment.  Something like this:

    { start : 16;
      another : 16 : offset(256);   (* location would be 256 bits from start *)
    }

(6) and:

    { start : 16;
      another : 16 : align(32);     (* implicit 16 bit gap before this *)
    }

(7) Assertions:

    { start : 16 : assert (offset = 0); }

   (Q: Are these evaluated at compile time or at run time or selectable?)

(8) Named but unbound patterns to avoid "Warning Y: unused variable".

(9) DONE -
    Make the error locations fine-grained, particularly so they point to
    individual fields, not the whole match.

(10) DONE - Cross-module, persistent, named patterns, see:
  http://caml.inria.fr/pub/ml-archives/caml-list/2008/04/25992c9c9fa999fe1d35d961dd9917a2.en.html

(11) DONE -
     Runtime endiannness expressions.  The suggested syntax is:

    { field : len : endian (expr) }

    where expr would evaluate to something like BigEndian or
    LittleEndian.

    There are several protocols around where endianness is only
    determined at runtime, examples are libpcap and TIFF.

(12) DONE - More constant field lengths.

(13) PARTLY DONE - Implement native endian functions.

(14) PARTLY DONE - A proper test suite.

(15) DONE - More examples:

    ELF binaries
    GIF images

(16) We now know the offset of the current field relative to the
     whole match.  This may allow more efficient aligned versions
     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).