module Make (
X
:
EMPTY
)
: S
Create a new bitfield type
type
t = private int
Generative type of bitfields. Each instantiation of the functor
should create a new, incompatible type
val empty : t
Empty bitfields (all bits 0)
type '_
field_kind =
module type FIELD = sig
.. end
Field of type value
, with a given width and position within the
bitfield type
type 'a
field = (module CCBitField.S.FIELD with type value = 'a)
val bool : ?name:string -> unit -> bool field
New field of type bool
RaisesFrozen
if freeze ()
was called
TooManyFields
if there is no room
val int2 : ?name:string -> unit -> int field
New field of type 2-bits int (same as
int ~width:2
)
RaisesFrozen
if freeze ()
was called
TooManyFields
if there is no room
val int3 : ?name:string -> unit -> int field
New field of type 3-bits int (same as
int ~width:3
)
RaisesFrozen
if freeze ()
was called
TooManyFields
if there is no room
val int : ?name:string -> width:int -> unit -> int field
New field for
width
bits.
RaisesFrozen
if freeze ()
was called
Invalid_argument
if width is not <= 1
TooManyFields
if there is no room
val freeze : unit -> unit
Prevent new fields from being added. From now on, creating
a field will raise Frozen
val total_width : unit -> int
Current width of the bitfield
type
any_field =
val iter_fields : (any_field -> unit) -> unit
Iterate on all currently present fields
val pp : Format.formatter -> t -> unit
Print the bitfield using the current list of fields