Module Bin_prot.Common
Buffers
type pos_ref= pos Stdlib.refReference to a position within buffers
type buf= (char, Stdlib.Bigarray.int8_unsigned_elt, Stdlib.Bigarray.c_layout) Stdlib.Bigarray.Array1.tBuffers
val create_buf : int -> bufcreate_buf ncreates a buffer of sizen.
val buf_len : buf -> intbuf_len bufreturns the length ofbuf.
val assert_pos : pos -> unitassert_pos pos- raises Invalid_argument
if position
posis negative.
val check_pos : buf -> pos -> unitcheck_pos buf pos- raises Buffer_short
if position
posexceeds the length of bufferbuf.
val check_next : buf -> pos -> unitcheck_next buf pos- raises Buffer_short
if the next position after
posexceeds the length of bufferbuf.
val safe_get_pos : buf -> pos_ref -> possafe_get_pos buf pos_ref- returns
the position referenced by
pos_refwithin bufferbuf.@raise Buffer_short
if the position exceeds the length of the buffer.
val blit_string_buf : ?src_pos:int -> string -> ?dst_pos:int -> buf -> len:int -> unitblit_string_buf ?src_pos src ?dst_pos dst ~lenblitslenbytes of the source stringsrcstarting at positionsrc_posto bufferdststarting at positiondst_pos.- raises Invalid_argument
if the designated ranges are invalid.
val blit_bytes_buf : ?src_pos:int -> bytes -> ?dst_pos:int -> buf -> len:int -> unitblit_bytes_buf ?src_pos src ?dst_pos dst ~lenblitslenbytes of the source byte sequencesrcstarting at positionsrc_posto bufferdststarting at positiondst_pos.- raises Invalid_argument
if the designated ranges are invalid.
val blit_buf_string : ?src_pos:int -> buf -> ?dst_pos:int -> bytes -> len:int -> unitblit_buf_string ?src_pos src ?dst_pos dst ~lenblitslenbytes of the source buffersrcstarting at positionsrc_posto stringdststarting at positiondst_pos.- raises Invalid_argument
if the designated ranges are invalid.
val blit_buf_bytes : ?src_pos:int -> buf -> ?dst_pos:int -> bytes -> len:int -> unitblit_buf_bytes ?src_pos src ?dst_pos dst ~lenblitslenbytes of the source buffersrcstarting at positionsrc_posto byte sequencedststarting at positiondst_pos.- raises Invalid_argument
if the designated ranges are invalid.
val blit_buf : ?src_pos:int -> src:buf -> ?dst_pos:int -> dst:buf -> int -> unitblit_buf ?src_pos ~src ?dst_pos ~dst lenblitslenbytes of the source buffersrcstarting at positionsrc_posto destination bufferdststarting at positiondst_pos.- raises Invalid_argument
if the designated ranges are invalid.
Errors and exceptions
module ReadError : sig ... endexceptionRead_error of ReadError.t * posReadError (err, err_pos)
exceptionPoly_rec_write of stringPolyRecWrite typegets raised when the user attempts to write or estimate the size of a value of a type that is bound through a polymorphic record field in type definitiontype.
exceptionEmpty_type of stringEmptyTypegets raised when the user attempts to write or estimate the size of a value of an empty type, which would not make sense.
val raise_read_error : ReadError.t -> pos -> 'araise_read_error err pos
val raise_variant_wrong_type : string -> pos -> 'araise_variant_wrong_type name pos
Bigarrays
type vec32= (float, Stdlib.Bigarray.float32_elt, Stdlib.Bigarray.fortran_layout) Stdlib.Bigarray.Array1.ttype vec64= (float, Stdlib.Bigarray.float64_elt, Stdlib.Bigarray.fortran_layout) Stdlib.Bigarray.Array1.ttype vec= vec64type mat32= (float, Stdlib.Bigarray.float32_elt, Stdlib.Bigarray.fortran_layout) Stdlib.Bigarray.Array2.ttype mat64= (float, Stdlib.Bigarray.float64_elt, Stdlib.Bigarray.fortran_layout) Stdlib.Bigarray.Array2.ttype mat= mat64
Miscellaneous
NOTE: unsafe functions!!!
val unsafe_blit_buf : src_pos:int -> src:buf -> dst_pos:int -> dst:buf -> len:int -> unitval unsafe_blit_string_buf : src_pos:int -> string -> dst_pos:int -> buf -> len:int -> unitval unsafe_blit_bytes_buf : src_pos:int -> bytes -> dst_pos:int -> buf -> len:int -> unitval unsafe_blit_buf_string : src_pos:int -> buf -> dst_pos:int -> bytes -> len:int -> unitval unsafe_blit_buf_bytes : src_pos:int -> buf -> dst_pos:int -> bytes -> len:int -> unitval unsafe_blit_float_array_buf : src_pos:int -> float array -> dst_pos:int -> buf -> len:int -> unitval unsafe_blit_buf_float_array : src_pos:int -> buf -> dst_pos:int -> float array -> len:int -> unit