scanfn = buf.lexfn;
lexbuf = Lexing.from_function (fun bytebuf n ->
let count = ref 0 in
- Rope.iteri (fun i c ->
+ Rope.each_byte (fun i c ->
Bytes.set bytebuf !count (Char.chr c);
incr count;
(!count >= n)) buf.rope !pos;
(******************************************************************************)
-(* inefficient form of iteri *)
-let rec iteri fn rope pos =
+let rec each_byte fn rope pos =
if pos < (length rope) && (fn pos (getb rope pos)) then
- iteri fn rope (pos + 1)
+ each_byte fn rope (pos + 1)
let gets rope i j =
let buf = Bytes.create (j - i) in
- iteri
+ each_byte
(fun n c ->
Bytes.set buf (n - i) (Char.chr c);
(n <= j))
val split : rope -> int -> (rope * rope)
val del : rope -> int -> int -> rope
-val iteri : (int -> rune -> bool) -> rope -> int -> unit
+val each_byte : (int -> rune -> bool) -> rope -> int -> unit
val each_rune : (int -> rune -> bool) -> rope -> int -> unit
val getb : rope -> int -> int