summaryrefslogtreecommitdiff
path: root/libguile/unif.c
diff options
context:
space:
mode:
authorMarius Vollmer <mvo@zagadka.de>2006-02-12 01:01:46 +0000
committerMarius Vollmer <mvo@zagadka.de>2006-02-12 01:01:46 +0000
commit1aaa1c171edd094072f5b4202fd480e0f40c2aad (patch)
tree31b0ffdf3dcf7eb46d3a7cc4ee0756253bf7e864 /libguile/unif.c
parentd7c6575f3f77db3bd4ea7bcac7d283f885dae6aa (diff)
downloadguile-1aaa1c171edd094072f5b4202fd480e0f40c2aad.tar.gz
* deprecated.scm (make-uniform-array): Don't pass the prototype as
the fill value, dimensions->uniform-array will do the right thing now. See scm_dimensions_to_uniform_array why we need to be tricky about the fill value. * unif.c (scm_dimensions_to_uniform_array): Use the prototype for filling when the fill parameter is omitted, as documented, but turn #\nul into 0 since s8 arrays (signified by a #\nul prototype) can not store characters.
Diffstat (limited to 'libguile/unif.c')
-rw-r--r--libguile/unif.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/libguile/unif.c b/libguile/unif.c
index 1cdc47895..14438b5f6 100644
--- a/libguile/unif.c
+++ b/libguile/unif.c
@@ -796,6 +796,18 @@ SCM_DEFINE (scm_dimensions_to_uniform_array, "dimensions->uniform-array", 2, 1,
if (scm_is_integer (dims))
dims = scm_list_1 (dims);
+
+ if (SCM_UNBNDP (fill))
+ {
+ /* Using #\nul as the prototype yields a s8 array, but numeric
+ arrays can't store characters, so we have to special case this.
+ */
+ if (scm_is_eq (prot, SCM_MAKE_CHAR (0)))
+ fill = scm_from_int (0);
+ else
+ fill = prot;
+ }
+
return scm_make_typed_array (prototype_to_type (prot), fill, dims);
}
#undef FUNC_NAME