[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Tue, 31 Jan 2006 14:42:07 +0100
Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux)
William Xu <address@hidden> writes:
> Is the following the correct way of using `uniform-array-read!'? Seems
> it simply hangs there..
> (let ((ar (make-uniform-array #\nul length)))
> (uniform-array-read! ar sockfd))
In your example, it can very well be hanging because there is nothing to
read from SOCKFD (e.g., it's making a blocking `read' system call
Using Guile 1.7:
guile> (define a (make-uniform-array #\nul 10))
guile> (uniform-array-read! a (open-input-string (string #\001 #\002 #\003)))
#s8(1 2 3 32 51 10 -102 96 48 10)
IOW, it seems to work fine --- except that:
1. The array is not properly initialized;
2. The result is not a string as one would expect from the Guile 1.6
manual[*] (in fact it could hardly be a string since internally
strings may not contain null characters AFAIK).
So 1.7 is _not_ compatible with 1.6 in that respect. I guess we need to
In 1.7, `make-uniform-array' is deprecated and replaced by
`make-typed-array' (BTW, this deprecation is not currently documented in
the 1.7 manual):
-- Scheme Procedure: make-typed-array type fill bound ...
-- C Function: scm_make_typed_array (type, fill, bounds)
Create and return an array that has as many dimensions as there are
BOUNDs and (maybe) fill it with FILL.
Hope this helps,
[*] From node `Uniform Arrays':
Unshared uniform arrays of characters with a single zero-based dimension
are identical to strings:
(make-uniform-array #\a 3) =>
Unshared uniform arrays of booleans with a single zero-based dimension
are identical to *Note bit-vectors: Bit Vectors.
(make-uniform-array #t 3) =>