summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorDaniel Llorens <lloda@sarc.name>2021-08-17 16:47:04 +0200
committerDaniel Llorens <lloda@sarc.name>2021-08-17 16:47:04 +0200
commit9a62f7cacaf730fca07f6cfd400a1893c2c2acb6 (patch)
tree47af3f85a9adc4703da274c771e893c4b73ee3ae /doc
parent926f70f9b589eaa43e9b066e8cdd58e0d67435ed (diff)
downloadguile-9a62f7cacaf730fca07f6cfd400a1893c2c2acb6.tar.gz
Extend bytevector-fill! to handle a partial fill
* libguile/bytevectors.c (bytevector-fill!): As stated. (scm_bytevector_fill_x): Stub to avoid changing the C API. * doc/ref/api-data.texi: Documentation. * libguile/vectors.c (vector-fill!): Less confusing variable names. * test-suite/tests/bytevectors.test: Test partial fill cases for bytevector-fill!.
Diffstat (limited to 'doc')
-rw-r--r--doc/ref/api-data.texi18
1 files changed, 14 insertions, 4 deletions
diff --git a/doc/ref/api-data.texi b/doc/ref/api-data.texi
index b41cffdef..f695b1934 100644
--- a/doc/ref/api-data.texi
+++ b/doc/ref/api-data.texi
@@ -3424,6 +3424,7 @@ Like @code{scm_string_set_x}, but the index is given as a @code{size_t}.
@end deftypefn
@rnindex string-fill!
+@anchor{x-string-fill!}
@deffn {Scheme Procedure} string-fill! str chr [start [end]]
@deffnx {C Function} scm_substring_fill_x (str, chr, start, end)
@deffnx {C Function} scm_string_fill_x (str, chr)
@@ -6383,6 +6384,7 @@ Store @var{obj} in position @var{k} (a @code{size_t}) of @var{vec}.
@end deftypefn
@rnindex vector-fill!
+@anchor{x-vector-fill!}
@deffn {Scheme Procedure} vector-fill! vec fill [start [end]]
@deffnx {C Function} scm_vector_fill_x (vec, fill)
Store @var{fill} in every position of @var{vec} in the range
@@ -6821,17 +6823,25 @@ Return is @var{bv1} equals to @var{bv2}---i.e., if they have the same
length and contents.
@end deffn
-@deffn {Scheme Procedure} bytevector-fill! bv fill
+@deffn {Scheme Procedure} bytevector-fill! bv fill [start [end]]
@deffnx {C Function} scm_bytevector_fill_x (bv, fill)
-Fill bytevector @var{bv} with @var{fill}, a byte.
+Fill positions [@var{start} ... @var{end}) of bytevector @var{bv} with
+byte @var{fill}. @var{start} defaults to 0 and @var{end} defaults to the
+length of @var{bv}.@footnote{R6RS defines @code{(bytevector-fill! bv
+fill)}. Arguments @var{start} and @var{end} are a Guile extension
+(cf. @ref{x-vector-fill!,@code{vector-fill!}},
+@ref{x-string-fill!,@code{string-fill!}}).}
@end deffn
@deffn {Scheme Procedure} bytevector-copy! source source-start target target-start len
@deffnx {C Function} scm_bytevector_copy_x (source, source_start, target, target_start, len)
Copy @var{len} bytes from @var{source} into @var{target}, starting
reading from @var{source-start} (a positive index within @var{source})
-and start writing at @var{target-start}. It is permitted for the
-@var{source} and @var{target} regions to overlap.
+and writing at @var{target-start}.
+
+It is permitted for the @var{source} and @var{target} regions to
+overlap. In that case, copying takes place as if the source is first
+copied into a temporary bytevector and then into the destination.
@end deffn
@deffn {Scheme Procedure} bytevector-copy bv