diff --git a/NEWS-array-fixes.txt b/NEWS-array-fixes.txt new file mode 100644 index 000000000..6d97a526f --- /dev/null +++ b/NEWS-array-fixes.txt @@ -0,0 +1,28 @@ + +TBA to NEWS for this branch. + +* Forward incompatible changes + +Applying these changes will make your program work with this version of +Guile and continue working with older versions. + +** vector->list and vector-copy require a true vector argument. + +Use array->list and array-copy (from (ice-9 arrays)) on general arrays. + +** scm_vector_elements / scm_vector_writable_elements require a true vector argument. + +Use scm_array_get_handle and scm_array_handle_elements / +scm_array_handle_writable_elements on general arrays. + +* Backward incompatible changes + +Applying these changes will make your program work with this version of +Guile and STOP working with older versions. + +** scm_array_p takes a single argument. + +This function used to take a second unused argument for the sake of +compatibility with older versions of Guile. Just remove this argument from your +calls. + diff --git a/doc/ref/api-data.texi b/doc/ref/api-data.texi index 750f71195..c70e3e28c 100644 --- a/doc/ref/api-data.texi +++ b/doc/ref/api-data.texi @@ -7327,13 +7327,9 @@ values, one for each dimension. @deffn {Scheme Procedure} array? obj -@deffnx {C Function} scm_array_p (obj, unused) +@deffnx {C Function} scm_array_p (obj) Return @code{#t} if the @var{obj} is an array, and @code{#f} if not. - -The second argument to scm_array_p is there for historical reasons, -but it is not used. You should always pass @code{SCM_UNDEFINED} as -its value. @end deffn @deffn {Scheme Procedure} typed-array? obj type diff --git a/libguile/generalized-arrays.c b/libguile/generalized-arrays.c index 28ca6b3c7..a48012f4b 100644 --- a/libguile/generalized-arrays.c +++ b/libguile/generalized-arrays.c @@ -62,25 +62,16 @@ scm_is_array (SCM obj) } } -SCM_DEFINE (scm_array_p_2, "array?", 1, 0, 0, +SCM_DEFINE (scm_array_p, "array?", 1, 0, 0, (SCM obj), "Return @code{#t} if the @var{obj} is an array, and @code{#f} if\n" "not.") -#define FUNC_NAME s_scm_array_p_2 +#define FUNC_NAME s_scm_array_p { return scm_from_bool (scm_is_array (obj)); } #undef FUNC_NAME -/* The array type predicate, with an extra argument kept for backward - compatibility. Note that we can't use `SCM_DEFINE' directly because there - would be an argument count mismatch that would be caught by - `snarf-check-and-output-texi.scm'. */ -SCM -scm_array_p (SCM obj, SCM unused) -{ - return scm_array_p_2 (obj); -} int scm_is_typed_array (SCM obj, SCM type) diff --git a/libguile/generalized-arrays.h b/libguile/generalized-arrays.h index 130807b29..5e7e9812c 100644 --- a/libguile/generalized-arrays.h +++ b/libguile/generalized-arrays.h @@ -35,7 +35,7 @@ #define SCM_VALIDATE_ARRAY(pos, v) \ do { \ SCM_ASSERT (SCM_HEAP_OBJECT_P (v) \ - && scm_is_true (scm_array_p (v, SCM_UNDEFINED)), \ + && scm_is_true (scm_array_p (v)), \ v, pos, FUNC_NAME); \ } while (0) @@ -43,8 +43,7 @@ /** Arrays */ SCM_API int scm_is_array (SCM obj); -SCM_API SCM scm_array_p (SCM v, SCM unused); -SCM_INTERNAL SCM scm_array_p_2 (SCM); +SCM_API SCM scm_array_p (SCM v); SCM_API int scm_is_typed_array (SCM obj, SCM type); SCM_API SCM scm_typed_array_p (SCM v, SCM type);