From c08deb2b5e3dcbae2213521dfb3614194801a625 Mon Sep 17 00:00:00 2001 From: Neil Jerram Date: Sun, 18 Nov 2001 22:20:34 +0000 Subject: [PATCH] * Updates for string- and vector-move-right/left! docstrings. * Update Tcl war URLs. --- doc/ref/ChangeLog | 5 +++ doc/ref/scheme-data.texi | 68 ++++++++++--------------------------- doc/tutorial/ChangeLog | 5 +++ doc/tutorial/guile-tut.texi | 4 +-- libguile/ChangeLog | 7 ++++ libguile/vectors.c | 16 +++++++-- 6 files changed, 50 insertions(+), 55 deletions(-) diff --git a/doc/ref/ChangeLog b/doc/ref/ChangeLog index af376dda7..86db64a6d 100644 --- a/doc/ref/ChangeLog +++ b/doc/ref/ChangeLog @@ -1,3 +1,8 @@ +2001-11-18 Neil Jerram + + * scheme-data.texi (String Modification, Vectors): Autoupdate docs + for substring-move!, vector-move-left! and vector-move-right!. + 2001-11-14 Thien-Thi Nguyen * scheme-procedures.texi: Spell "library" correctly. diff --git a/doc/ref/scheme-data.texi b/doc/ref/scheme-data.texi index 9cea8bb6f..3530f92bc 100755 --- a/doc/ref/scheme-data.texi +++ b/doc/ref/scheme-data.texi @@ -1552,55 +1552,9 @@ y @end deffn @deffn primitive substring-move! str1 start1 end1 str2 start2 -@deffnx primitive substring-move-left! str1 start1 end1 str2 start2 -@deffnx primitive substring-move-right! str1 start1 end1 str2 start2 Copy the substring of @var{str1} bounded by @var{start1} and @var{end1} into @var{str2} beginning at position @var{start2}. -@code{substring-move-right!} begins copying from the rightmost character -and moves left, and @code{substring-move-left!} copies from the leftmost -character moving right. - -It is useful to have two functions that copy in different directions so -that substrings can be copied back and forth within a single string. If -you wish to copy text from the left-hand side of a string to the -right-hand side of the same string, and the source and destination -overlap, you must be careful to copy the rightmost characters of the -text first, to avoid clobbering your data. Hence, when @var{str1} and -@var{str2} are the same string, you should use -@code{substring-move-right!} when moving text from left to right, and -@code{substring-move-left!} otherwise. If @code{str1} and @samp{str2} -are different strings, it does not matter which function you use. - -@example -(define x (make-string 10 #\a)) -(define y "bcd") -(substring-move-left! x 2 5 y 0) -y -@result{} "aaa" - -x -@result{} "aaaaaaaaaa" - -(define y "bcdefg") -(substring-move-left! x 2 5 y 0) -y -@result{} "aaaefg" - -(define y "abcdefg") -(substring-move-left! y 2 5 y 3) -y -@result{} "abccccg" - -(define y "abcdefg") -(substring-move-right! y 2 5 y 0) -y -@result{} "ededefg" - -(define y "abcdefg") -(substring-move-right! y 2 5 y 3) -y -@result{} "abccdeg" -@end example +@var{str1} and @var{str2} can be the same string. @end deffn @@ -3389,13 +3343,25 @@ returned by @code{vector-fill!} is unspecified. @end deffn @deffn primitive vector-move-left! vec1 start1 end1 vec2 start2 -Vector version of @code{substring-move-left!} (@pxref{String -Modification}). +Copy elements from @var{vec1}, positions @var{start1} to @var{end1}, +to @var{vec2} starting at position @var{start2}. @var{start1} and +@var{start2} are inclusive indices; @var{end1} is exclusive. + +@code{vector-move-left!} copies elements in leftmost order. +Therefore, in the case where @var{vec1} and @var{vec2} refer to the +same vector, @code{vector-move-left!} is usually appropriate when +@var{start1} is greater than @var{start2}. @end deffn @deffn primitive vector-move-right! vec1 start1 end1 vec2 start2 -Vector version of @code{substring-move-right!} (@pxref{String -Modification}). +Copy elements from @var{vec1}, positions @var{start1} to @var{end1}, +to @var{vec2} starting at position @var{start2}. @var{start1} and +@var{start2} are inclusive indices; @var{end1} is exclusive. + +@code{vector-move-right!} copies elements in rightmost order. +Therefore, in the case where @var{vec1} and @var{vec2} refer to the +same vector, @code{vector-move-right!} is usually appropriate when +@var{start1} is less than @var{start2}. @end deffn @subsection Vector Selection diff --git a/doc/tutorial/ChangeLog b/doc/tutorial/ChangeLog index b784f824c..eea1de221 100644 --- a/doc/tutorial/ChangeLog +++ b/doc/tutorial/ChangeLog @@ -1,3 +1,8 @@ +2001-11-18 Neil Jerram + + * guile-tut.texi (History of Guile and its motivations): Update + Tcl war URLs. + 2001-09-19 Thien-Thi Nguyen * guile-tut.texi: Fix improper `@result' usage. diff --git a/doc/tutorial/guile-tut.texi b/doc/tutorial/guile-tut.texi index 477cdac3e..eb6345d86 100644 --- a/doc/tutorial/guile-tut.texi +++ b/doc/tutorial/guile-tut.texi @@ -285,7 +285,7 @@ In the fall of 1994, Richard Stallman, director of the GNU project, posted an article with the subject "Why you should not use Tcl", in which he argued that Tcl is inadequate as an extension language. This generated a flurry of flames (available in the hypermail archive -(@url{http://www.utdallas.edu/acc/glv/Tcl/war/}) @strong{The Tcl War}). +(@url{http://www.vanderburg.org/Tcl/war/}) @strong{The Tcl War}). @cindex Stallman, Richard @cindex GNU project @cindex Tcl @@ -293,7 +293,7 @@ generated a flurry of flames (available in the hypermail archive The result was that Stallman then proposed his design for the GNU Extension Language, first called GEL and then renamed Guile. The discussion triggered by that article is also available in a hypermail -archive, @url{http://www.utdallas.edu/acc/glv/Tcl/war2/}. +archive, @url{http://www.vanderburg.org/Tcl/war2/}. One interesting feature of this GNU Extension Language plan was that users should have a @emph{choice} of languages to use in extending their diff --git a/libguile/ChangeLog b/libguile/ChangeLog index 6d33937cf..ec0f72cdf 100644 --- a/libguile/ChangeLog +++ b/libguile/ChangeLog @@ -1,3 +1,10 @@ +2001-11-18 Neil Jerram + + * vectors.c (scm_vector_move_left_x, scm_vector_move_right_x): + Rewrite docstrings without reference to substring-move-left/right, + because the latter are now deprecated and don't in fact differ in + their left/right behaviour. + 2001-11-13 Marius Vollmer * modules.c (scm_c_export): Call va_end after collecting the diff --git a/libguile/vectors.c b/libguile/vectors.c index 8280b113e..50c4630fc 100644 --- a/libguile/vectors.c +++ b/libguile/vectors.c @@ -360,7 +360,13 @@ scm_vector_equal_p(SCM x, SCM y) SCM_DEFINE (scm_vector_move_left_x, "vector-move-left!", 5, 0, 0, (SCM vec1, SCM start1, SCM end1, SCM vec2, SCM start2), - "Vector version of @code{substring-move-left!}.") + "Copy elements from @var{vec1}, positions @var{start1} to @var{end1},\n" + "to @var{vec2} starting at position @var{start2}. @var{start1} and\n" + "@var{start2} are inclusive indices; @var{end1} is exclusive.\n\n" + "@code{vector-move-left!} copies elements in leftmost order.\n" + "Therefore, in the case where @var{vec1} and @var{vec2} refer to the\n" + "same vector, @code{vector-move-left!} is usually appropriate when\n" + "@var{start1} is greater than @var{start2}.") #define FUNC_NAME s_scm_vector_move_left_x { long i; @@ -383,7 +389,13 @@ SCM_DEFINE (scm_vector_move_left_x, "vector-move-left!", 5, 0, 0, SCM_DEFINE (scm_vector_move_right_x, "vector-move-right!", 5, 0, 0, (SCM vec1, SCM start1, SCM end1, SCM vec2, SCM start2), - "Vector version of @code{substring-move-right!}.") + "Copy elements from @var{vec1}, positions @var{start1} to @var{end1},\n" + "to @var{vec2} starting at position @var{start2}. @var{start1} and\n" + "@var{start2} are inclusive indices; @var{end1} is exclusive.\n\n" + "@code{vector-move-right!} copies elements in rightmost order.\n" + "Therefore, in the case where @var{vec1} and @var{vec2} refer to the\n" + "same vector, @code{vector-move-right!} is usually appropriate when\n" + "@var{start1} is less than @var{start2}.") #define FUNC_NAME s_scm_vector_move_right_x { long i;