123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175moduleDefinitions=structopenCommon(** Type of writer functions for the binary protocol. They take a buffer,
a write position and a value, and return the next position after
writing out the value. *)type'awriter=buf->pos:pos->'a->postype('a,'b)writer1='awriter->'bwritertype('a,'b,'c)writer2='awriter->('b,'c)writer1type('a,'b,'c,'d)writer3='awriter->('b,'c,'d)writer2type'awriter_local=buf->pos:pos->'a->postype('a,'b)writer_local1='awriter_local->'bwriter_localtype('a,'b,'c)writer_local2='awriter_local->('b,'c)writer_local1type('a,'b,'c,'d)writer_local3='awriter_local->('b,'c,'d)writer_local2endmoduletypeWrite=sig(** Writing values to the binary protocol using (mostly) OCaml. *)openCommonincludemoduletypeofstructincludeDefinitionsendvalbin_write_unit:unitwritervalbin_write_bool:boolwritervalbin_write_string:stringwritervalbin_write_bytes:byteswritervalbin_write_char:charwritervalbin_write_int:intwritervalbin_write_nat0:Nat0.twritervalbin_write_float:floatwritervalbin_write_int32:int32writervalbin_write_int64:int64writervalbin_write_nativeint:nativeintwritervalbin_write_ref:('a,'aref)writer1valbin_write_lazy:('a,'alazy_t)writer1valbin_write_option:('a,'aoption)writer1valbin_write_pair:('a,'b,'a*'b)writer2valbin_write_triple:('a,'b,'c,'a*'b*'c)writer3valbin_write_list:('a,'alist)writer1valbin_write_array:('a,'aarray)writer1valbin_write_hashtbl:('a,'b,('a,'b)Hashtbl.t)writer2valbin_write_float32_vec:vec32writervalbin_write_float64_vec:vec64writervalbin_write_vec:vecwritervalbin_write_float32_mat:mat32writervalbin_write_float64_mat:mat64writervalbin_write_mat:matwritervalbin_write_bigstring:bufwritervalbin_write_floatarray:floatarraywritervalbin_write_md5:Md5_lib.twriter(** [bin_write_variant_int] writes out the exact little-endian bit
representation of the variant tag of the given value (= 32 bits). *)valbin_write_variant_int:intwriter(** [bin_write_int_8bit] writes out the exact little-endian bit representation
of the given [int] value using the lower 8 bits. *)valbin_write_int_8bit:intwriter(** [bin_write_int_16bit] writes out the exact little-endian bit representation
of the given [int] value using the lower 16 bits. *)valbin_write_int_16bit:intwriter(** [bin_write_int_32bit] writes out the exact little-endian bit representation
of the given [int] value using the lower 32 bits. *)valbin_write_int_32bit:intwriter(** [bin_write_int_64bit] writes out the exact little-endian bit representation
of the given [int] value using all 64 bits. On 32bit platforms negative
numbers will be sign-extended in the 64bit representation. *)valbin_write_int_64bit:intwriter(** [bin_write_int64_bits] writes out the exact little-endian bit
representation of the given [int64] value. *)valbin_write_int64_bits:int64writer(** [bin_write_network16_int] writes out an integer in 16bit network
byte order (= big-endian). *)valbin_write_network16_int:intwriter(** [bin_write_network32_int] writes out an integer in 32bit network
byte order (= big-endian). *)valbin_write_network32_int:intwriter(** [bin_write_network32_int32] writes out a 32bit integer in 32bit
network byte order (= big-endian). *)valbin_write_network32_int32:int32writer(** [bin_write_network64_int] writes out an integer in 64bit network
byte order (= big-endian). *)valbin_write_network64_int:intwriter(** [bin_write_network64_int64] writes out a 64bit integer in 64bit
network byte order (= big-endian). *)valbin_write_network64_int64:int64writer(* Local versions *)valbin_write_unit__local:unitwriter_localvalbin_write_bool__local:boolwriter_localvalbin_write_string__local:stringwriter_localvalbin_write_bytes__local:byteswriter_localvalbin_write_char__local:charwriter_localvalbin_write_int__local:intwriter_localvalbin_write_nat0__local:Nat0.twriter_localvalbin_write_float__local:floatwriter_localvalbin_write_int32__local:int32writer_localvalbin_write_int64__local:int64writer_localvalbin_write_nativeint__local:nativeintwriter_localvalbin_write_ref__local:('a,'aref)writer_local1valbin_write_lazy__local:('a,'alazy_t)writer_local1valbin_write_option__local:('a,'aoption)writer_local1valbin_write_pair__local:('a,'b,'a*'b)writer_local2valbin_write_triple__local:('a,'b,'c,'a*'b*'c)writer_local3valbin_write_list__local:('a,'alist)writer_local1valbin_write_array__local:('a,'aarray)writer_local1valbin_write_float32_vec__local:vec32writer_localvalbin_write_float64_vec__local:vec64writer_localvalbin_write_vec__local:vecwriter_localvalbin_write_float32_mat__local:mat32writer_localvalbin_write_float64_mat__local:mat64writer_localvalbin_write_mat__local:matwriter_localvalbin_write_bigstring__local:bufwriter_localvalbin_write_floatarray__local:floatarraywriter_localvalbin_write_md5__local:Md5_lib.twriter_local(** [bin_write_variant_int__local] writes out the exact little-endian bit
representation of the variant tag of the given value (= 32 bits). *)valbin_write_variant_int__local:intwriter_local(** [bin_write_int_8bit__local] writes out the exact little-endian bit representation
of the given [int] value using the lower 8 bits. *)valbin_write_int_8bit__local:intwriter_local(** [bin_write_int_16bit__local] writes out the exact little-endian bit representation
of the given [int] value using the lower 16 bits. *)valbin_write_int_16bit__local:intwriter_local(** [bin_write_int_32bit__local] writes out the exact little-endian bit representation
of the given [int] value using the lower 32 bits. *)valbin_write_int_32bit__local:intwriter_local(** [bin_write_int_64bit__local] writes out the exact little-endian bit representation
of the given [int] value using all 64 bits. On 32bit platforms negative
numbers will be sign-extended in the 64bit representation. *)valbin_write_int_64bit__local:intwriter_local(** [bin_write_int64_bits__local] writes out the exact little-endian bit
representation of the given [int64] value. *)valbin_write_int64_bits__local:int64writer_local(** [bin_write_network16_int__local] writes out an integer in 16bit network
byte order (= big-endian). *)valbin_write_network16_int__local:intwriter_local(** [bin_write_network32_int__local] writes out an integer in 32bit network
byte order (= big-endian). *)valbin_write_network32_int__local:intwriter_local(** [bin_write_network32_int32__local] writes out a 32bit integer in 32bit
network byte order (= big-endian). *)valbin_write_network32_int32__local:int32writer_local(** [bin_write_network64_int__local] writes out an integer in 64bit network
byte order (= big-endian). *)valbin_write_network64_int__local:intwriter_local(** [bin_write_network64_int64__local] writes out a 64bit integer in 64bit
network byte order (= big-endian). *)valbin_write_network64_int64__local:int64writer_localend