Module Read_c

module Read_c: sig .. end
Wrapping unsafe C-style readers to safe ML-style ones.

Generic functions for easy creation of wrappers

val make : 'a Unsafe_read_c.reader -> 'a Read_ml.reader
make c_reader takes an unsafe C-style reader c_reader.
Returns a safe ML-style reader.
val make1 : ('a, 'b) Unsafe_read_c.reader1 -> ('a, 'b) Read_ml.reader1
make1 mk_c_reader ml_el_reader takes a higher-order C-style reader mk_c_reader and an ML-reader ml_el_reader that operates on the same type as the argument of the C-style reader.
Returns ML-style reader for the higher-order type.
val make2 : ('a, 'b, 'c) Unsafe_read_c.reader2 -> ('a, 'b, 'c) Read_ml.reader2
make2 mk_c_reader ml_el1_reader ml_el2_reader like Read_c.make1 but operates on unsafe C-style write functions for types with two type parameters.
val make3 : ('a, 'b, 'c, 'd) Unsafe_read_c.reader3 -> ('a, 'b, 'c, 'd) Read_ml.reader3
make3 mk_c_reader ml_el1_reader ml_el2_reader ml_el3_reader like Read_c.make1 but operates on unsafe C-style write functions for types with three type parameters.
val unmake : 'b Read_ml.reader -> Common.buf -> 'b Unsafe_read_c.reader
unmake ml_reader buf takes an ML-style reader ml_reader and a buffer. This function can be used to wrap higher-order type conversion functions and, together with Unsafe_common.get_sptr_ptr, and Read_c.handle_error, is used in e.g. Read_c.make1, Read_c.make2 and Read_c.make3 for that purpose.
Returns an unsafe C-style reader.
val handle_error : Common.buf -> Unsafe_common.sptr_ptr -> Common.ReadError.t -> 'a
handle_error buf sptr_ptr err deallocates sptr_ptr for buffer buf.
Raises ReadError with the appropriate location information and err then.
val handle_exc : Common.buf -> Unsafe_common.sptr_ptr -> exn -> 'a
handle_exc buf sptr_ptr exc deallocates sptr_ptr for buffer buf. raise exc then.
val at_end : Common.buf -> Unsafe_common.sptr_ptr -> Common.pos_ref -> 'a -> 'a
at_end buf sptr_ptr pos_ref el deallocates sptr_ptr for buffer buf, sets pos_ref to the new position, then returns el.

Unsafe C-style readers for basic types wrapped as ML-style readers

val bin_read_unit : unit Read_ml.reader
val bin_read_bool : bool Read_ml.reader
val bin_read_string : string Read_ml.reader
val bin_read_char : char Read_ml.reader
val bin_read_int : int Read_ml.reader
val bin_read_nat0 : Nat0.t Read_ml.reader
val bin_read_float : float Read_ml.reader
val bin_read_int32 : int32 Read_ml.reader
val bin_read_int64 : int64 Read_ml.reader
val bin_read_nativeint : nativeint Read_ml.reader
val bin_read_ref : ('a, 'a Pervasives.ref) Read_ml.reader1
val bin_read_lazy : ('a, 'a lazy_t) Read_ml.reader1
val bin_read_option : ('a, 'a option) Read_ml.reader1
val bin_read_pair : ('a, 'b, 'a * 'b) Read_ml.reader2
val bin_read_triple : ('a, 'b, 'c, 'a * 'b * 'c) Read_ml.reader3
val bin_read_list : ('a, 'a list) Read_ml.reader1
val bin_read_array : ('a, 'a array) Read_ml.reader1
val bin_read_hashtbl : ('a, 'b, ('a, 'b) Hashtbl.t) Read_ml.reader2
val bin_read_float32_vec : Common.vec32 Read_ml.reader
val bin_read_float64_vec : Common.vec64 Read_ml.reader
val bin_read_vec : Common.vec Read_ml.reader
val bin_read_float32_mat : Common.mat32 Read_ml.reader
val bin_read_float64_mat : Common.mat64 Read_ml.reader
val bin_read_mat : Common.mat Read_ml.reader
val bin_read_bigstring : Common.buf Read_ml.reader
val bin_read_float_array : float array Read_ml.reader
val bin_read_variant_int : int Read_ml.reader
val bin_read_variant_tag : [>  ] Read_ml.reader
val bin_read_int_64bit : int Read_ml.reader
val bin_read_int64_bits : int64 Read_ml.reader
val bin_read_network16_int : int Read_ml.reader
val bin_read_network32_int : int Read_ml.reader
val bin_read_network32_int32 : int32 Read_ml.reader
val bin_read_network64_int : int Read_ml.reader
val bin_read_network64_int64 : int64 Read_ml.reader