emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r117128: Allow any non-nil value to count as true in


From: Paul Eggert
Subject: [Emacs-diffs] trunk r117128: Allow any non-nil value to count as true in bool-vector.
Date: Mon, 19 May 2014 19:19:10 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 117128
revision-id: address@hidden
parent: address@hidden
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Mon 2014-05-19 12:19:05 -0700
message:
  Allow any non-nil value to count as true in bool-vector.
  
  Likewise for xd_signature in dbusbind.c.
  This is more consistent with the usual practice in Emacs, which is
  that any non-nil value counts as true.
  * doc/lispref/sequences.texi (Bool-Vectors): Coalesce discussion of how to
  print them.  bool-vector's args need not be t or nil.
  * src/alloc.c (Fbool_vector): Don't require args to be t or nil.
  * src/dbusbind.c (xd_signature): Likewise, for booleans.
  * src/data.c, lisp.h (Qbooleanp):
  * src/lisp.h (CHECK_BOOLEAN): Remove.  All uses removed.
modified:
  doc/lispref/ChangeLog          changelog-20091113204419-o5vbwnq5f7feedwu-6155
  doc/lispref/sequences.texi     
sequences.texi-20091113204419-o5vbwnq5f7feedwu-6209
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/alloc.c                    alloc.c-20091113204419-o5vbwnq5f7feedwu-252
  src/data.c                     data.c-20091113204419-o5vbwnq5f7feedwu-251
  src/dbusbind.c                 dbusbind.c-20091113204419-o5vbwnq5f7feedwu-7961
  src/lisp.h                     lisp.h-20091113204419-o5vbwnq5f7feedwu-253
=== modified file 'doc/lispref/ChangeLog'
--- a/doc/lispref/ChangeLog     2014-05-19 07:49:09 +0000
+++ b/doc/lispref/ChangeLog     2014-05-19 19:19:05 +0000
@@ -1,3 +1,9 @@
+2014-05-19  Paul Eggert  <address@hidden>
+
+       Allow any non-nil value to count as true in bool-vector.
+       * sequences.texi (Bool-Vectors): Coalesce discussion of how to
+       print them.  bool-vector's args need not be t or nil.
+
 2014-05-19  Dmitry Antipov  <address@hidden>
 
        * sequences.texi (Bool-vectors): Mention bool-vector.

=== modified file 'doc/lispref/sequences.texi'
--- a/doc/lispref/sequences.texi        2014-05-19 07:49:09 +0000
+++ b/doc/lispref/sequences.texi        2014-05-19 19:19:05 +0000
@@ -811,7 +811,7 @@
 and the length cannot be changed once the bool-vector is created.
 Bool-vectors are constants when evaluated.
 
-  There are three special functions for working with bool-vectors; aside
+  Several functions work specifically with bool-vectors; aside
 from that, you manipulate them with same functions used for other kinds
 of arrays.
 
@@ -822,28 +822,7 @@
 
 @defun bool-vector &rest objects
 This function creates and returns a bool-vector whose elements are the
-arguments, @var{objects}, each of them should be either @code{t} or @code{nil}.
-Note that the printed form represents up to 8 boolean values as a single
-character:
-
address@hidden
address@hidden
-(bool-vector t nil t nil)
-     @result{} #&4"^E"
-(bool-vector)
-     @result{} #&0""
address@hidden group
address@hidden example
-
-If you want to print a bool-vector in a way similar to other vectors,
-you can use @code{vconcat} function:
-
address@hidden
address@hidden
-(vconcat (bool-vector nil t nil t))
-     @result{} [nil t nil t]
address@hidden group
address@hidden example
+arguments, @var{objects}.
 @end defun
 
 @defun bool-vector-p object
@@ -899,6 +878,27 @@
 Return the number of elements that are @code{t} in bool vector @var{a}.
 @end defun
 
+  The printed form represents up to 8 boolean values as a single
+character:
+
address@hidden
address@hidden
+(bool-vector t nil t nil)
+     @result{} #&4"^E"
+(bool-vector)
+     @result{} #&0""
address@hidden group
address@hidden example
+
+You can use @code{vconcat} to print a bool-vector like other vectors:
+
address@hidden
address@hidden
+(vconcat (bool-vector nil t nil t))
+     @result{} [nil t nil t]
address@hidden group
address@hidden example
+
   Here is another example of creating, examining, and updating a
 bool-vector:
 

=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2014-05-19 07:54:39 +0000
+++ b/src/ChangeLog     2014-05-19 19:19:05 +0000
@@ -1,3 +1,14 @@
+2014-05-19  Paul Eggert  <address@hidden>
+
+       Allow any non-nil value to count as true in bool-vector.
+       Likewise for xd_signature in dbusbind.c.
+       This is more consistent with the usual practice in Emacs, which is
+       that any non-nil value counts as true.
+       * alloc.c (Fbool_vector): Don't require args to be t or nil.
+       * dbusbind.c (xd_signature): Likewise, for booleans.
+       * data.c, lisp.h (Qbooleanp):
+       * lisp.h (CHECK_BOOLEAN): Remove.  All uses removed.
+
 2014-05-19  Dmitry Antipov  <address@hidden>
 
        * lisp.h (CHECK_BOOLEAN): New function.

=== modified file 'src/alloc.c'
--- a/src/alloc.c       2014-05-19 07:49:09 +0000
+++ b/src/alloc.c       2014-05-19 19:19:05 +0000
@@ -2177,16 +2177,12 @@
 DEFUN ("bool-vector", Fbool_vector, Sbool_vector, 0, MANY, 0,
        doc: /* Return a new bool-vector with specified arguments as elements.
 Any number of arguments, even zero arguments, are allowed.
-Each argument should be either t or nil.
 usage: (bool-vector &rest OBJECTS)  */)
   (ptrdiff_t nargs, Lisp_Object *args)
 {
   ptrdiff_t i;
   Lisp_Object vector;
 
-  for (i = 0; i < nargs; i++)
-    CHECK_BOOLEAN (args[i]);
-
   vector = make_uninit_bool_vector (nargs);
   for (i = 0; i < nargs; i++)
     bool_vector_set (vector, i, !NILP (args[i]));

=== modified file 'src/data.c'
--- a/src/data.c        2014-05-19 07:49:09 +0000
+++ b/src/data.c        2014-05-19 19:19:05 +0000
@@ -54,7 +54,7 @@
 Lisp_Object Qbeginning_of_buffer, Qend_of_buffer, Qbuffer_read_only;
 Lisp_Object Qtext_read_only;
 
-Lisp_Object Qintegerp, Qwholenump, Qsymbolp, Qlistp, Qconsp, Qbooleanp;
+Lisp_Object Qintegerp, Qwholenump, Qsymbolp, Qlistp, Qconsp;
 static Lisp_Object Qnatnump;
 Lisp_Object Qstringp, Qarrayp, Qsequencep, Qbufferp;
 Lisp_Object Qchar_or_string_p, Qmarkerp, Qinteger_or_marker_p, Qvectorp;
@@ -3442,7 +3442,6 @@
 
   DEFSYM (Qlistp, "listp");
   DEFSYM (Qconsp, "consp");
-  DEFSYM (Qbooleanp, "booleanp");
   DEFSYM (Qsymbolp, "symbolp");
   DEFSYM (Qkeywordp, "keywordp");
   DEFSYM (Qintegerp, "integerp");

=== modified file 'src/dbusbind.c'
--- a/src/dbusbind.c    2014-05-19 07:49:09 +0000
+++ b/src/dbusbind.c    2014-05-19 19:19:05 +0000
@@ -387,7 +387,8 @@
       break;
 
     case DBUS_TYPE_BOOLEAN:
-      CHECK_BOOLEAN (object);
+      /* Every Emacs Lisp object serves as a boolean, so there's nothing
+        to check.  */
       sprintf (signature, "%c", dtype);
       break;
 

=== modified file 'src/lisp.h'
--- a/src/lisp.h        2014-05-19 07:49:09 +0000
+++ b/src/lisp.h        2014-05-19 19:19:05 +0000
@@ -796,7 +796,7 @@
 /* Defined in data.c.  */
 extern Lisp_Object Qarrayp, Qbufferp, Qbuffer_or_string_p, Qchar_table_p;
 extern Lisp_Object Qconsp, Qfloatp, Qintegerp, Qlambda, Qlistp, Qmarkerp, Qnil;
-extern Lisp_Object Qnumberp, Qstringp, Qsymbolp, Qt, Qvectorp, Qbooleanp;
+extern Lisp_Object Qnumberp, Qstringp, Qsymbolp, Qt, Qvectorp;
 extern Lisp_Object Qbool_vector_p;
 extern Lisp_Object Qvector_or_char_table_p, Qwholenump;
 extern Lisp_Object Qwindow;
@@ -2510,11 +2510,6 @@
   CHECK_TYPE (CONSP (x), Qconsp, x);
 }
 INLINE void
-CHECK_BOOLEAN (Lisp_Object x)
-{
-  CHECK_TYPE (EQ (x, Qt) || EQ (x, Qnil), Qbooleanp, x);
-}
-INLINE void
 CHECK_VECTOR (Lisp_Object x)
 {
   CHECK_TYPE (VECTORP (x), Qvectorp, x);


reply via email to

[Prev in Thread] Current Thread [Next in Thread]