Skip to content
This repository
tag: v1477
Fetching contributors…

Cannot retrieve contributors at this time

file 63 lines (52 sloc) 1.995 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
(*
Copyright © 2011 MLstate

This file is part of OPA.

OPA is free software: you can redistribute it and/or modify it under the
terms of the GNU Affero General Public License, version 3, as published by
the Free Software Foundation.

OPA is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
more details.

You should have received a copy of the GNU Affero General Public License
along with OPA. If not, see <http://www.gnu.org/licenses/>.
*)

(**
* Simple library, intended to have some of the properties of both
* String and Buffer. No automatic resize but it can be done manually.
**)

(** This type is concrete **)
type buf = { mutable str : string; mutable i : int; }

(** Global flag for resize **)
type resize_mode = RM_stdout | RM_stderr | RM_custom of (string -> unit) | RM_failwith | RM_exit | RM_noresize
val auto_resize : resize_mode ref

(** Common to String and Buffer **)
type t = buf
val length : buf -> int
val create : int -> buf
val sub : buf -> int -> int -> string

(** Compatibility with String *)
val make : int -> char -> buf
val get : buf -> int -> char
val unsafe_get : buf -> int -> char
val set : buf -> int -> char -> unit
val unsafe_set : buf -> int -> char -> unit
val copy : buf -> buf

(** Compatibility with Buffer **)
val nth : buf -> int -> char
val clear : buf -> unit
val reset : buf -> unit
val add_char : buf -> char -> unit
val add_string : buf -> string -> unit
val add_substring : buf -> string -> int -> int -> unit
val contents : buf -> string

(** Specifics **)
val empty : unit -> buf
val append : buf -> string -> int -> unit
val add_buf : buf -> buf -> unit
val of_string : string -> buf
val to_string : buf -> string
val resize : buf -> int -> unit
val extend : buf -> int -> unit
val real_length : buf -> int
val spare : buf -> int
Something went wrong with that request. Please try again.