module Unsafe_common:Unsafe_common: functions common to unsafe binary protocol conversion.sig..end
USE WITH CAUTION!
type sptr
type eptr
type sptr_ptr
val get_sptr : Common.buf -> pos:Common.pos -> sptrget_sptr buf ~posbuf
and start position pos.val get_eptr : Common.buf -> pos:Common.pos -> eptrget_eptr buf ~posbuf
and end position pos.val shift_sptr : sptr -> int -> sptrshift_sptr sptr nsptr by n
characters.val get_eptr_from_sptr_ptr : sptr_ptr -> pos:Common.pos -> eptrget_eptr_from_sptr_ptr sptr_ptr ~pospos after location sptr_ptr.val get_buf_pos : start:sptr -> cur:sptr -> Common.posget_buf_pos ~start ~curstart and cur.val get_safe_buf_pos : Common.buf ->
start:sptr -> cur:sptr -> Common.posget_safe_buf_pos buf ~start ~curstart and cur. buf is
ignored, but prevents the buffer from being reclaimed by the GC,
which it needs to until this function gets called.val alloc_sptr_ptr : Common.buf -> pos:Common.pos -> sptr_ptralloc_sptr_ptr buf ~pos allocate a pointer to a start pointer.
NOTE: do not forget to deallocate it, otherwise there will be a
space leak!
NOTE: The "noalloc" attribute is correct, because it indicates
there is no OCaml allocation. alloc_sptr_ptr only does C
allocation.val dealloc_sptr_ptr : Common.buf -> sptr_ptr -> Common.posdealloc_sptr_ptr buf sptr_ptr deallocate a pointer to a start
pointer and return its position. NOTE: do not do this more than
once, otherwise the program may crash!val get_sptr_ptr : sptr_ptr -> Common.buf -> Common.posget_sptr_ptr sptr_ptr bufbuf
denoted by the pointer stored in sptr_ptr.val set_sptr_ptr : sptr_ptr -> Common.buf -> pos:Common.pos -> unitset_sptr_ptr sptr_ptr buf ~pos sets the pointer in sptr_ptr
to the location denoted by position pos in buffer buf.val get_sptr_ptr_sptr : sptr_ptr -> sptrget_sptr_ptr_sptr sptr_ptrsptr_ptr.val set_sptr_ptr_sptr : sptr_ptr -> sptr -> unitset_sptr_ptr_sptr sptr_ptr sptr sets the pointer in
sptr_ptr to sptr.val get_ptr_string : sptr -> eptr -> stringget_ptr_string sptr_ptr eptrsptr to end pointer eptr.val get_read_init : Common.buf ->
pos_ref:Common.pos Pervasives.ref ->
sptr_ptr * eptrget_read_init buf ~pos_refsptr_ptr denoting the
start and the eptr denoting the end of buffer buf. NOTE: do
not forget to deallocate the sptr_ptr!