This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GNU Guile".
http://git.savannah.gnu.org/cgit/guile.git/commit/?id=73d1aaafb226b5e386b6b2eeacc40b836ff85940 The branch, master has been updated via 73d1aaafb226b5e386b6b2eeacc40b836ff85940 (commit) from a70c0ff578712ab8170aea0d2fb0d9b53cee8c5c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 73d1aaafb226b5e386b6b2eeacc40b836ff85940 Author: Ludovic Courtès <l...@gnu.org> Date: Wed Jan 20 23:58:39 2010 +0100 Fix `uniform-vector-read!' and `uniform-vector-write'. * libguile/deprecated.c (scm_uniform_vector_read_x, scm_uniform_vector-write): Account for optional arguments. Make sure the former always returns an integer. * libguile/deprecated.h (scm_uniform_vector_read_x, scm_uniform_vector_write, scm_uniform_array_read_x, scm_uniform_array_write): Mark as `SCM_DEPRECATED'. ----------------------------------------------------------------------- Summary of changes: libguile/deprecated.c | 55 ++++++++++++++++++++++++++++++++++-------------- libguile/deprecated.h | 16 +++++++------- 2 files changed, 47 insertions(+), 24 deletions(-) diff --git a/libguile/deprecated.c b/libguile/deprecated.c index e8cec8a..54f0055 100644 --- a/libguile/deprecated.c +++ b/libguile/deprecated.c @@ -1354,20 +1354,34 @@ SCM_DEFINE (scm_uniform_vector_read_x, "uniform-vector-read!", 1, 3, 0, "to the value returned by @code{(current-input-port)}.") #define FUNC_NAME s_scm_uniform_vector_read_x { - size_t width; + SCM result; + size_t c_width, c_start, c_end; + SCM_VALIDATE_BYTEVECTOR (SCM_ARG1, uvec); - scm_c_issue_deprecation_warning + scm_c_issue_deprecation_warning ("`uniform-vector-read!' is deprecated. Use `get-bytevector-n!' from\n" "`(rnrs io ports)' instead."); - width = scm_to_size_t (scm_uniform_vector_element_size (uvec)); + if (SCM_UNBNDP (port_or_fd)) + port_or_fd = scm_current_input_port (); + + c_width = scm_to_size_t (scm_uniform_vector_element_size (uvec)); - return scm_get_bytevector_n_x (port_or_fd, uvec, - scm_from_size_t (scm_to_size_t (start)*width), - scm_from_size_t ((scm_to_size_t (end) - - scm_to_size_t (start)) - * width)); + c_start = SCM_UNBNDP (start) ? 0 : scm_to_size_t (start); + c_start *= c_width; + + c_end = SCM_UNBNDP (end) ? SCM_BYTEVECTOR_LENGTH (uvec) : scm_to_size_t (end); + c_end *= c_width; + + result = scm_get_bytevector_n_x (port_or_fd, uvec, + scm_from_size_t (c_start), + scm_from_size_t (c_end - c_start)); + + if (SCM_EOF_OBJECT_P (result)) + result = SCM_INUM0; + + return result; } #undef FUNC_NAME @@ -1391,21 +1405,30 @@ SCM_DEFINE (scm_uniform_vector_write, "uniform-vector-write", 1, 3, 0, "@code{(current-output-port)}.") #define FUNC_NAME s_scm_uniform_vector_write { - size_t width; + size_t c_width, c_start, c_end; + SCM_VALIDATE_BYTEVECTOR (SCM_ARG1, uvec); - port_or_fd = SCM_COERCE_OUTPORT (port_or_fd); - scm_c_issue_deprecation_warning + scm_c_issue_deprecation_warning ("`uniform-vector-write' is deprecated. Use `put-bytevector' from\n" "`(rnrs io ports)' instead."); - width = scm_to_size_t (scm_uniform_vector_element_size (uvec)); + if (SCM_UNBNDP (port_or_fd)) + port_or_fd = scm_current_output_port (); + + port_or_fd = SCM_COERCE_OUTPORT (port_or_fd); + + c_width = scm_to_size_t (scm_uniform_vector_element_size (uvec)); + + c_start = SCM_UNBNDP (start) ? 0 : scm_to_size_t (start); + c_start *= c_width; + + c_end = SCM_UNBNDP (end) ? SCM_BYTEVECTOR_LENGTH (uvec) : scm_to_size_t (end); + c_end *= c_width; return scm_put_bytevector (port_or_fd, uvec, - scm_from_size_t (scm_to_size_t (start)*width), - scm_from_size_t ((scm_to_size_t (end) - - scm_to_size_t (start)) - * width)); + scm_from_size_t (c_start), + scm_from_size_t (c_end - c_start)); } #undef FUNC_NAME diff --git a/libguile/deprecated.h b/libguile/deprecated.h index 8ecd8b2..9832cfb 100644 --- a/libguile/deprecated.h +++ b/libguile/deprecated.h @@ -483,14 +483,14 @@ SCM_DEPRECATED scm_t_array_dim *scm_i_array_dims (SCM a); #define SCM_ARRAY_BASE(a) scm_i_array_base(a) #define SCM_ARRAY_DIMS(a) scm_i_array_dims(a) -SCM_API SCM scm_uniform_vector_read_x (SCM v, SCM port_or_fd, - SCM start, SCM end); -SCM_API SCM scm_uniform_vector_write (SCM v, SCM port_or_fd, - SCM start, SCM end); -SCM_API SCM scm_uniform_array_read_x (SCM ra, SCM port_or_fd, - SCM start, SCM end); -SCM_API SCM scm_uniform_array_write (SCM v, SCM port_or_fd, - SCM start, SCM end); +SCM_DEPRECATED SCM scm_uniform_vector_read_x (SCM v, SCM port_or_fd, + SCM start, SCM end); +SCM_DEPRECATED SCM scm_uniform_vector_write (SCM v, SCM port_or_fd, + SCM start, SCM end); +SCM_DEPRECATED SCM scm_uniform_array_read_x (SCM ra, SCM port_or_fd, + SCM start, SCM end); +SCM_DEPRECATED SCM scm_uniform_array_write (SCM v, SCM port_or_fd, + SCM start, SCM end); /* Deprecated because they should not be lvalues and we want people to use the official interfaces. hooks/post-receive -- GNU Guile