carbon2-commit: Fix a multiple-value bug, mapcarX; correct a comment and a label name.

Aidan Kehoe kehoea at parhasard.net
Fri Mar 5 12:47:11 EST 2010


changeset:   5084:1b96882bdf37
user:        Aidan Kehoe <kehoea at parhasard.net>
date:        Fri Feb 19 23:21:27 2010 +0000
files:       src/ChangeLog src/fns.c tests/ChangeLog tests/automated/lisp-tests.el
description:
Fix a multiple-value bug, mapcarX; correct a comment and a label name.

src/ChangeLog addition:

2010-02-19  Aidan Kehoe  <kehoea at parhasard.net>

	* fns.c (mapcarX):
	Correct this function, discarding multiple values when one
	SEQUENCE is supplied, choosing a better label name.  Correct the
	comment describing the SOME_OR_EVERY argument.

tests/ChangeLog addition:

2010-02-19  Aidan Kehoe  <kehoea at parhasard.net>

	* automated/lisp-tests.el:
	Check that multiple values are discarded correctly with #'mapcar
	and one SEQUENCE.


diff -r d2c3bac89ba0 -r 1b96882bdf37 src/ChangeLog
--- a/src/ChangeLog	Fri Feb 19 09:30:45 2010 +0000
+++ b/src/ChangeLog	Fri Feb 19 23:21:27 2010 +0000
@@ -1,3 +1,10 @@
+2010-02-19  Aidan Kehoe  <kehoea at parhasard.net>
+
+	* fns.c (mapcarX):
+	Correct this function, discarding multiple values when one
+	SEQUENCE is supplied, choosing a better label name.  Correct the
+	comment describing the SOME_OR_EVERY argument.
+
 2010-02-12  Aidan Kehoe  <kehoea at parhasard.net>
 
 	* syswindows.h:
diff -r d2c3bac89ba0 -r 1b96882bdf37 src/fns.c
--- a/src/fns.c	Fri Feb 19 09:30:45 2010 +0000
+++ b/src/fns.c	Fri Feb 19 23:21:27 2010 +0000
@@ -3231,7 +3231,8 @@
    taking the elements from SEQUENCES.  If VALS is non-NULL, store the
    results into VALS, a C array of Lisp_Objects; else, if LISP_VALS is
    non-nil, store the results into LISP_VALS, a sequence with sufficient
-   room for CALL_COUNT results. Else, do not accumulate any result.
+   room for CALL_COUNT results (but see the documentation of SOME_OR_EVERY.) 
+   Else, do not accumulate any result.
 
    If VALS is non-NULL, NSEQUENCES is one, and SEQUENCES[0] is a cons,
    mapcarX will store the elements of SEQUENCES[0] in stack and GCPRO them,
@@ -3246,11 +3247,10 @@
 
    If SOME_OR_EVERY is SOME_OR_EVERY_SOME, return the (possibly multiple)
    values given by FUNCTION the first time it is non-nil, and abandon the
-   iterations.  LISP_VALS in this case must be an object created by
-   make_opaque_ptr, dereferenced as pointing to a Lisp object. If
-   SOME_OR_EVERY is SOME_OR_EVERY_EVERY, store Qnil at the Lisp_Object
-   pointer address provided by LISP_VALS if FUNCTION gives nil; otherwise
-   leave it alone. */
+   iterations.  LISP_VALS must be a cons, and the return value will be
+   stored in its car.  If SOME_OR_EVERY is SOME_OR_EVERY_EVERY, store Qnil
+   in the car of LISP_VALS if FUNCTION gives nil; otherwise leave it
+   alone. */
 
 #define SOME_OR_EVERY_NEITHER 0
 #define SOME_OR_EVERY_SOME    1
@@ -3306,7 +3306,7 @@
       for (i = 0; i < call_count; ++i)
 	{
 	  args[1] = vals[i];
-	  vals[i] = Ffuncall (nsequences + 1, args);
+	  vals[i] = IGNORE_MULTIPLE_VALUES (Ffuncall (nsequences + 1, args));
 	}
     }
   else
@@ -3413,7 +3413,7 @@
 			break;
 		      }
 
-		    goto bad_show_or_every_flag;
+		    goto bad_some_or_every_flag;
 		  }
 		case lrecord_type_vector:
 		  {
@@ -3443,7 +3443,7 @@
 		      (void) Faset (lisp_vals, make_int (i), called);
 		    break;
 		  }
-		bad_show_or_every_flag:
+		bad_some_or_every_flag:
 		default:
 		  {
 		    ABORT();
diff -r d2c3bac89ba0 -r 1b96882bdf37 tests/ChangeLog
--- a/tests/ChangeLog	Fri Feb 19 09:30:45 2010 +0000
+++ b/tests/ChangeLog	Fri Feb 19 23:21:27 2010 +0000
@@ -1,3 +1,9 @@
+2010-02-19  Aidan Kehoe  <kehoea at parhasard.net>
+
+	* automated/lisp-tests.el:
+	Check that multiple values are discarded correctly with #'mapcar
+	and one SEQUENCE.
+
 2010-02-05  Jerry James  <james at xemacs.org>
 
 	* DLL/dltest.c: Remove old test.  Building and using any module now
diff -r d2c3bac89ba0 -r 1b96882bdf37 tests/automated/lisp-tests.el
--- a/tests/automated/lisp-tests.el	Fri Feb 19 09:30:45 2010 +0000
+++ b/tests/automated/lisp-tests.el	Fri Feb 19 23:21:27 2010 +0000
@@ -972,6 +972,12 @@
 	(setcdr (cdr x) 42)) ; drop a brick wall onto the freeway
       (car y))
     x)))
+
+(Assert-eql
+ (length (multiple-value-list
+          (car (mapcar #'(lambda (argument) (floor argument)) (list pi e)))))
+ 1
+ "checking multiple values are correctly discarded in mapcar")
 
 ;;-----------------------------------------------------
 ;; Test vector functions



More information about the XEmacs-Patches mailing list