Module Tjr_fs_shared.Buf_ops

Buffer operations including blit, moved from Tjr_btree.

Don't use this module directly; instead use buf_ops#string_ etc

NOTE this uses value passing; to check linear usage, use the "safe_" version which tracks liveness of each buffer

val chr0 : char
type 'buf buf_ops = {
buf_create : int -> 'buf;
buf_length : 'buf -> int;
buf_get : int -> 'buf -> char;
buf_to_string : src:'buf -> off:Int_like.offset -> len:Int_like.len -> string;
to_string : 'buf -> string;
of_string : string -> 'buf;
to_bytes : 'buf -> bytes;
of_bytes : bytes -> 'buf;
of_ba : Bigstring.t -> 'buf;
buf_sub : buf:'buf -> off:int -> len:int -> 'buf;
blit : src:'buf -> src_off:Int_like.offset -> src_len:Int_like.len -> dst:'buf -> dst_off:Int_like.offset -> 'buf;
blit_bytes_to_buf : src:bytes -> src_off:Int_like.offset -> src_len:Int_like.len -> dst:'buf -> dst_off:Int_like.offset -> 'buf;
blit_string_to_buf : src:string -> src_off:Int_like.offset -> src_len:Int_like.len -> dst:'buf -> dst_off:Int_like.offset -> 'buf;
}

"mutable", fixed size buffers; it is an error to attempt to write beyond the end; prefer a functional repr. for now

NOTE we use the value-passing intf

$(FIXME("change default buffer implementation to bytes or bigstring for production"))

type ba_buf = (char, Stdlib.Bigarray.int8_unsigned_elt, Stdlib.Bigarray.c_layout) Stdlib.Bigarray.Array1.t
type ba_buf_ops = ba_buf buf_ops
type by_buf_ops = bytes buf_ops
module B_ = Stdlib.BytesLabels
module Check_blit : functor (S : sig ... end) -> sig ... end
module String_ : sig ... end
module Abstract_string : sig ... end

Abstract buffer type, with underlying string representation; FIXME move to mutable implementation for production

module Bytes_ : sig ... end
module Abstract_bytes : sig ... end

Abstract buffer type, with underlying bytes representation

module Bigstring_ : sig ... end

NOTE this does not check linearity; use something else for testing

val buf_ops : < abstract_bytes : Abstract_bytes.t buf_ops; abstract_string : Abstract_string.t buf_ops; ba : Bigstring.t buf_ops; bytes : Stdlib.Bytes.t buf_ops; string : string buf_ops; >

Export all implementations under object value buf_ops