Module Write_c

module Write_c: sig .. end
Wrapping unsafe C-style writers to safe ML-style ones.


Generic functions for easy creation of wrappers


val unsafe_get_init : Common.buf ->
pos:Common.pos ->
Unsafe_common.sptr * Unsafe_common.sptr * Unsafe_common.eptr
unsafe_get_init buf ~pos
Returns the triple (start, sptr, eptr) where start is the pointer to the start of buffer buf, sptr the pointer to the position pos in buf, and eptr the pointer to the end of the buffer. NOTE: you must make sure that buf remains unreclaimed as long as any of the three pointers is accessible!
val make : 'a Unsafe_write_c.writer -> 'a Write_ml.writer
make c_writer takes an unsafe C-style writer c_writer.
Returns a safe ML-style writer.
val make1 : ('a, 'b) Unsafe_write_c.writer1 -> ('a, 'b) Write_ml.writer1
make1 mk_c_writer ml_el_writer takes a higher-order C-style writer mk_c_writer and an ML-writer ml_el_writer that operates on the same type as the argument of the C-style writer.
Returns ML-style writer for the higher-order type.
val make2 : ('a, 'b, 'c) Unsafe_write_c.writer2 -> ('a, 'b, 'c) Write_ml.writer2
make2 mk_c_writer ml_el1_writer ml_el2_writer like Write_c.make1 but operates on unsafe C-style write functions for types with two type parameters.
val make3 : ('a, 'b, 'c, 'd) Unsafe_write_c.writer3 -> ('a, 'b, 'c, 'd) Write_ml.writer3
make3 mk_c_writer ml_el1_writer ml_el2_writer ml_el3_writer like Write_c.make1 but operates on unsafe C-style write functions for types with three type parameters.
val unmake : 'a Write_ml.writer ->
Common.buf -> start:Unsafe_common.sptr -> 'a Unsafe_write_c.writer
unmake ml_writer buf ~start takes an ML-style writer ml_writer, a buffer, and the pointer start to the start of the buffer. This function can be used to wrap higher-order type conversion functions and, together with Write_c.unsafe_get_init, is used in e.g. Write_c.make1, Write_c.make2 and Write_c.make3 for that purpose.
Returns an unsafe C-style writer.

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


val bin_write_unit : unit Write_ml.writer
val bin_write_bool : bool Write_ml.writer
val bin_write_string : string Write_ml.writer
val bin_write_char : char Write_ml.writer
val bin_write_int : int Write_ml.writer
val bin_write_nat0 : Nat0.t Write_ml.writer
val bin_write_float : float Write_ml.writer
val bin_write_int32 : int32 Write_ml.writer
val bin_write_int64 : int64 Write_ml.writer
val bin_write_nativeint : nativeint Write_ml.writer
val bin_write_ref : ('a, 'a Pervasives.ref) Write_ml.writer1
val bin_write_lazy : ('a, 'a lazy_t) Write_ml.writer1
val bin_write_option : ('a, 'a option) Write_ml.writer1
val bin_write_pair : ('a, 'b, 'a * 'b) Write_ml.writer2
val bin_write_triple : ('a, 'b, 'c, 'a * 'b * 'c) Write_ml.writer3
val bin_write_list : ('a, 'a list) Write_ml.writer1
val bin_write_array : ('a, 'a array) Write_ml.writer1
val bin_write_hashtbl : ('a, 'b, ('a, 'b) Hashtbl.t) Write_ml.writer2
val bin_write_float32_vec : Common.vec32 Write_ml.writer
val bin_write_float64_vec : Common.vec64 Write_ml.writer
val bin_write_vec : Common.vec Write_ml.writer
val bin_write_float32_mat : Common.mat32 Write_ml.writer
val bin_write_float64_mat : Common.mat64 Write_ml.writer
val bin_write_mat : Common.mat Write_ml.writer
val bin_write_bigstring : Common.buf Write_ml.writer
val bin_write_float_array : float array Write_ml.writer
val bin_write_variant_tag : [>  ] Write_ml.writer
val bin_write_array_no_length : ('a, 'a array) Write_ml.writer1
val bin_write_int_64bit : int Write_ml.writer
val bin_write_int64_bits : int64 Write_ml.writer
val bin_write_network16_int : int Write_ml.writer
val bin_write_network32_int : int Write_ml.writer
val bin_write_network32_int32 : int32 Write_ml.writer
val bin_write_network64_int : int Write_ml.writer
val bin_write_network64_int64 : int64 Write_ml.writer