Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Rope.Buffer
SourceThis is similar to the Buffer
module in the standard library except that it constructs ropes. It is recommended to use this module instead of repeatedly concatenating chars.
Mutable buffer to construct ropes.
create n
returns a fresh buffer, initially empty. The n
parameter is the initial size of the internal rope that holds the buffer contents. The buffer will grow dynamically to accomodate new inputs.
add_char b c
appends the character c
at the end of the buffer b
.
add_string b s
appends the string s
at the end of the buffer b
.
add_substring b s ofs len
takes len
characters from offset ofs
in string s
and appends them at the end of the buffer b
.
add_channel b ic n
reads exactly n
characters from the input channel ic
and stores them at the end of buffer b
.
add_buffer b1 b2
appends the current contents of buffer b2
at the end of buffer b1
. b2
is not modified.
Return a copy of the current contents of the buffer. The buffer itself is unchanged.
sub b off len
returns a rope of the current contents of the buffer b
starting at offset off
of length len
bytes. The buffer itself is unaffected.