diff options
Diffstat (limited to 'otherlibs/labltk/support/support.ml')
-rw-r--r-- | otherlibs/labltk/support/support.ml | 40 |
1 files changed, 1 insertions, 39 deletions
diff --git a/otherlibs/labltk/support/support.ml b/otherlibs/labltk/support/support.ml index eee855cae..6e1e835bf 100644 --- a/otherlibs/labltk/support/support.ml +++ b/otherlibs/labltk/support/support.ml @@ -1,46 +1,8 @@ (* $Id$ *) -(* Extensible buffers *) -type extensible_buffer = { - mutable buffer : string; - mutable pos : int; - mutable len : int} - -let new_buffer () = { - buffer = String.create len:128; - pos = 0; - len = 128 - } - -let print_in_buffer buf s = - let l = String.length s in - if buf.pos + l > buf.len then begin - buf.buffer <- buf.buffer ^ (String.create len:(l+128)); - buf.len <- buf.len + 128 + l - end; - String.blit s pos:0 to:buf.buffer to_pos:buf.pos len:l; - buf.pos <- buf.pos + l - -let get_buffer buf = - String.sub buf.buffer pos:0 len:buf.pos - - - -(* Used by list converters *) -let catenate_sep sep = - function - [] -> "" - | [x] -> x - | x::l -> - let b = new_buffer() in - print_in_buffer b x; - List.iter l - fun:(function s -> print_in_buffer b sep; print_in_buffer b s); - get_buffer b - (* Parsing results of Tcl *) (* List.split a string according to char_sep predicate *) -let split_str char_sep str = +let split_str pred:char_sep str = let len = String.length str in let rec skip_sep cur = if cur >= len then cur |