This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

bit-count broken


Greetings,

In unif.c in bit-count, SCM_VALIDATE_INUM should be SCM_VALIDATE_ARRAY (or
some other suitable validation macro for bit-vectors).

I also got very disgusted with the differences in the documentation for procedures
and the arguments.  A (help bit-set*!) is very confusing!  Here is a patch that makes the docs the same as the args.  Better names should be given to both.

The patch has the bit-count fix along with the doc changes.

-Dale

-- 
Dale P. Smith
Altus Technologies Corp.
dsmith@altustech.com
400-746-9000 x309
--- unif.c	Fri May 19 11:06:44 2000
+++ unif.c.new	Fri May 19 11:06:03 2000
@@ -232,7 +232,7 @@
 
 SCM_DEFINE (scm_uniform_vector_length, "uniform-vector-length", 1, 0, 0, 
            (SCM v),
-	    "Returns the number of elements in @var{uve}.")
+	    "Returns the number of elements in @var{v}.")
 #define FUNC_NAME s_scm_uniform_vector_length
 {
   SCM_ASRTGO (SCM_NIMP (v), badarg1);
@@ -262,8 +262,8 @@
 
 SCM_DEFINE (scm_array_p, "array?", 1, 1, 0,
            (SCM v, SCM prot),
-	    "Returns @code{#t} if the @var{obj} is an array, and @code{#f} if not.\n\n"
-	    "The @var{prototype} argument is used with uniform arrays and is described\n"
+	    "Returns @code{#t} if the @var{v} is an array, and @code{#f} if not.\n\n"
+	    "The @var{prot} argument is used with uniform arrays and is described\n"
 	    "elsewhere.")
 #define FUNC_NAME s_scm_array_p
 {
@@ -334,7 +334,7 @@
 
 SCM_DEFINE (scm_array_rank, "array-rank", 1, 0, 0, 
            (SCM ra),
-	    "Returns the number of dimensions of @var{obj}.  If @var{obj} is not an\n"
+	    "Returns the number of dimensions of @var{ra}.  If @var{ra} is not an\n"
 	    "array, @code{0} is returned.")
 #define FUNC_NAME s_scm_array_rank
 {
@@ -552,9 +552,9 @@
            (SCM dims, SCM prot, SCM fill),
 	    "@deffnx primitive make-uniform-vector length prototype [fill]\n"
 	    "Creates and returns a uniform array or vector of type corresponding to\n"
-	    "@var{prototype} with dimensions @var{dims} or length @var{length}.  If\n"
+	    "@var{prot} with dimensions @var{dims} or length @var{length}.  If\n"
 	    "@var{fill} is supplied, it's used to fill the array, otherwise \n"
-	    "@var{prototype} is used.")
+	    "@var{prot} is used.")
 #define FUNC_NAME s_scm_dimensions_to_uniform_array
 {
   scm_sizet k, vlen = 1;
@@ -662,8 +662,8 @@
 SCM_DEFINE (scm_make_shared_array, "make-shared-array", 2, 0, 1,
            (SCM oldra, SCM mapfunc, SCM dims),
 	    "@code{make-shared-array} can be used to create shared subarrays of other\n"
-	    "arrays.  The @var{mapper} is a function that translates coordinates in\n"
-	    "the new array into coordinates in the old array.  A @var{mapper} must be\n"
+	    "arrays.  The @var{mapfunc} is a function that translates coordinates in\n"
+	    "the new array into coordinates in the old array.  A @var{mapfunc} must be\n"
 	    "linear, and its range must stay within the bounds of the old array, but\n"
 	    "it can be otherwise arbitrary.  A simple example:\n"
 	    "@example\n"
@@ -787,16 +787,16 @@
 /* args are RA . DIMS */
 SCM_DEFINE (scm_transpose_array, "transpose-array", 1, 0, 1, 
            (SCM ra, SCM args),
-	    "Returns an array sharing contents with @var{array}, but with dimensions\n"
+	    "Returns an array sharing contents with @var{ra}, but with dimensions\n"
 	    "arranged in a different order.  There must be one @var{dim} argument for\n"
-	    "each dimension of @var{array}.  @var{dim0}, @var{dim1}, @dots{} should\n"
+	    "each dimension of @var{ra}.  @var{dim0}, @var{dim1}, @dots{} should\n"
 	    "be integers between 0 and the rank of the array to be returned.  Each\n"
 	    "integer in that range must appear at least once in the argument list.\n\n"
 	    "The values of @var{dim0}, @var{dim1}, @dots{} correspond to dimensions\n"
 	    "in the array to be returned, their positions in the argument list to\n"
-	    "dimensions of @var{array}.  Several @var{dim}s may have the same value,\n"
+	    "dimensions of @var{ra}.  Several @var{dim}s may have the same value,\n"
 	    "in which case the returned array will have smaller rank than\n"
-	    "@var{array}.\n\n"
+	    "@var{ra}.\n\n"
 	    "examples:\n"
 	    "@example\n"
 	    "(transpose-array '#2((a b) (c d)) 1 0) @result{} #2((a c) (b d))\n"
@@ -895,7 +895,7 @@
 SCM_DEFINE (scm_enclose_array, "enclose-array", 1, 0, 1, 
            (SCM ra, SCM axes),
 	    "@var{dim0}, @var{dim1} @dots{} should be nonnegative integers less than\n"
-	    "the rank of @var{array}.  @var{enclose-array} returns an array\n"
+	    "the rank of @var{ra}.  @code{enclose-array} returns an array\n"
 	    "resembling an array of shared arrays.  The dimensions of each shared\n"
 	    "array are the same as the @var{dim}th dimensions of the original array,\n"
 	    "the dimensions of the outer array are the same as those of the original\n"
@@ -991,7 +991,7 @@
 
 SCM_DEFINE (scm_array_in_bounds_p, "array-in-bounds?", 1, 0, 1, 
            (SCM v, SCM args),
-	    "Returns @code{#t} if its arguments would be acceptable to array-ref.")
+	    "Returns @code{#t} if its arguments would be acceptable to @code{array-ref}.")
 #define FUNC_NAME s_scm_array_in_bounds_p
 {
   SCM ind = SCM_EOL;
@@ -1071,7 +1071,7 @@
 
 SCM_DEFINE (scm_uniform_vector_ref, "uniform-vector-ref", 2, 0, 0,
            (SCM v, SCM args),
-	    "Returns the element at the @code{(index1, index2)} element in @var{array}.")
+	    "Returns the element at the @code{(index1, index2)} element in @var{v}.")
 #define FUNC_NAME s_scm_uniform_vector_ref
 {
   long pos;
@@ -1244,8 +1244,8 @@
    PROC is used (and it's called from C too).  */
 SCM_DEFINE (scm_array_set_x, "array-set!", 2, 0, 1, 
            (SCM v, SCM obj, SCM args),
-	    "Sets the element at the @code{(index1, index2)} element in @var{array} to\n"
-	    "@var{new-value}.  The value returned by array-set! is unspecified.")
+	    "Sets the element at the @code{(index1, index2)} element in @var{v} to\n"
+	    "@var{obj}.  The value returned by array-set! is unspecified.")
 #define FUNC_NAME s_scm_array_set_x           
 {
   long pos = 0;
@@ -1348,7 +1348,7 @@
 SCM_DEFINE (scm_array_contents, "array-contents", 1, 1, 0,
            (SCM ra, SCM strict),
 	    "@deffnx primitive array-contents array strict\n"
-	    "If @var{array} may be @dfn{unrolled} into a one dimensional shared array\n"
+	    "If @var{ra} may be @dfn{unrolled} into a one dimensional shared array\n"
 	    "without changing their order (last subscript changing fastest), then\n"
 	    "@code{array-contents} returns that shared array, otherwise it returns\n"
 	    "@code{#f}.  All arrays made by @var{make-array} and\n"
@@ -1452,11 +1452,11 @@
 
 SCM_DEFINE (scm_uniform_array_read_x, "uniform-array-read!", 1, 3, 0,
            (SCM ra, SCM port_or_fd, SCM start, SCM end),
-	    "@deffnx primitive uniform-vector-read! uve [port-or-fdes] [start] [end]\n"
-	    "Attempts to read all elements of @var{ura}, in lexicographic order, as\n"
+	    "@deffnx primitive uniform-array-read! ra [port-or-fdes] [start] [end]\n"
+	    "Attempts to read all elements of @var{ra}, in lexicographic order, as\n"
 	    "binary objects from @var{port-or-fdes}.\n"
 	    "If an end of file is encountered during\n"
-	    "uniform-array-read! the objects up to that point only are put into @var{ura}\n"
+	    "uniform-array-read! the objects up to that point only are put into @var{ra}\n"
 	    "(starting at the beginning) and the remainder of the array is\n"
 	    "unchanged.\n\n"
 	    "The optional arguments @var{start} and @var{end} allow\n"
@@ -1604,8 +1604,8 @@
 
 SCM_DEFINE (scm_uniform_array_write, "uniform-array-write", 1, 3, 0,
            (SCM v, SCM port_or_fd, SCM start, SCM end),
-	    "@deffnx primitive uniform-vector-write uve [port-or-fdes] [start] [end]\n"
-	    "Writes all elements of @var{ura} as binary objects to\n"
+	    "@deffnx primitive uniform-array-write v [port-or-fdes] [start] [end]\n"
+	    "Writes all elements of @var{v} as binary objects to\n"
 	    "@var{port-or-fdes}.\n\n"
 	    "The optional arguments @var{start}\n"
 	    "and @var{end} allow\n"
@@ -1723,13 +1723,13 @@
 
 SCM_DEFINE (scm_bit_count, "bit-count", 2, 0, 0,
            (SCM item, SCM seq),
-	    "Returns the number occurrences of @var{bool} in @var{bv}.")
+	    "Returns the number occurrences of @var{item} in @var{seq}.")
 #define FUNC_NAME s_scm_bit_count
 {
   long i;
   register unsigned long cnt = 0;
   register unsigned long w;
-  SCM_VALIDATE_INUM (2,seq);
+  SCM_VALIDATE_ARRAY (2,seq);
   switch SCM_TYP7 (seq)
     {
     default:
@@ -1759,8 +1759,8 @@
 
 SCM_DEFINE (scm_bit_position, "bit-position", 3, 0, 0,
            (SCM item, SCM v, SCM k),
-	    "Returns the minimum index of an occurrence of @var{bool} in @var{bv}\n"
-	    "which is at least @var{k}.  If no @var{bool} occurs within the specified\n"
+	    "Returns the minimum index of an occurrence of @var{item} in @var{v}\n"
+	    "which is at least @var{k}.  If no @var{item} occurs within the specified\n"
 	    "range @code{#f} is returned.")
 #define FUNC_NAME s_scm_bit_position
 {
@@ -1827,12 +1827,12 @@
 
 SCM_DEFINE (scm_bit_set_star_x, "bit-set*!", 3, 0, 0,
            (SCM v, SCM kv, SCM obj),
-	    "If uve is a bit-vector @var{bv} and uve must be of the same length.  If\n"
-	    "@var{bool} is @code{#t}, uve is OR'ed into @var{bv}; If @var{bool} is @code{#f}, the\n"
-	    "inversion of uve is AND'ed into @var{bv}.\n\n"
-	    "If uve is a unsigned integer vector all the elements of uve must be\n"
-	    "between 0 and the @code{LENGTH} of @var{bv}.  The bits of @var{bv}\n"
-	    "corresponding to the indexes in uve are set to @var{bool}.\n\n"
+	    "If @var{kv) is a bit-vector, @var{v} and @var{kv} must be of the same length.  If\n"
+	    "@var{obj} is @code{#t}, @var{kv} is OR'ed into @var{v}; If @var{obj} is @code{#f}, the\n"
+	    "inversion of uve is AND'ed into @var{v}.\n\n"
+	    "If @var{kv} is a unsigned integer vector all the elements of @{kv} must be\n"
+	    "between 0 and the @code{LENGTH} of @var{v}.  The bits of @var{v}\n"
+	    "corresponding to the indexes in @var{kv} are set to @var{obj}.\n\n"
 	    "The return value is unspecified.")
 #define FUNC_NAME s_scm_bit_set_star_x
 {
@@ -1889,9 +1889,9 @@
            (SCM v, SCM kv, SCM obj),
 	    "Returns\n"
 	    "@example\n"
-	    "(bit-count (bit-set*! (if bool bv (bit-invert! bv)) uve #t) #t).\n"
+	    "(bit-count (bit-set*! (if obj v (bit-invert! v)) kv #t) #t).\n"
 	    "@end example\n"
-	    "@var{bv} is not modified.")
+	    "@var{v} is not modified.")
 #define FUNC_NAME s_scm_bit_count_star
 {
   register long i, vlen, count = 0;
@@ -1961,7 +1961,7 @@
 
 SCM_DEFINE (scm_bit_invert_x, "bit-invert!", 1, 0, 0, 
            (SCM v),
-	    "Modifies @var{bv} by replacing each element with its negation.")
+	    "Modifies @var{v} by replacing each element with its negation.")
 #define FUNC_NAME s_scm_bit_invert_x
 {
   register long k;
@@ -2044,7 +2044,7 @@
 
 SCM_DEFINE (scm_array_to_list, "array->list", 1, 0, 0, 
            (SCM v),
-	    "Returns a list consisting of all the elements, in order, of @var{array}.")
+	    "Returns a list consisting of all the elements, in order, of @var{v}.")
 #define FUNC_NAME s_scm_array_to_list
 {
   SCM res = SCM_EOL;
@@ -2136,7 +2136,7 @@
 
 SCM_DEFINE (scm_list_to_uniform_array, "list->uniform-array", 3, 0, 0,
            (SCM ndim, SCM prot, SCM lst),
-	    "@deffnx procedure list->uniform-vector prot lst\n"
+	    "@deffnx procedure list->uniform-vector ndim prot lst\n"
 	    "Returns a uniform array of the type indicated by prototype @var{prot}\n"
 	    "with elements the same as those of @var{lst}.  Elements must be of the\n"
 	    "appropriate type, no coercions are done.")
@@ -2488,7 +2488,7 @@
 SCM_DEFINE (scm_array_prototype, "array-prototype", 1, 0, 0, 
            (SCM ra),
 	    "Returns an object that would produce an array of the same type as\n"
-	    "@var{array}, if used as the @var{prototype} for\n"
+	    "@var{ra}, if used as the @var{prototype} for\n"
 	    "@code{make-uniform-array}.")
 #define FUNC_NAME s_scm_array_prototype
 {

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]