]> code.delx.au - gnu-emacs/blobdiff - src/data.c
Minor fixes in w32-shell-execute.
[gnu-emacs] / src / data.c
index 2c789f374315eea792f93c4f95d2c70038e1b1dc..1fe7a1c9b656edcc20951ede1345084af910150a 100644 (file)
@@ -1551,8 +1551,12 @@ Note that binding the variable with `let', or setting it while
 a `let'-style binding made in this buffer is in effect,
 does not make the variable buffer-local.  Return VARIABLE.
 
-In most cases it is better to use `make-local-variable',
-which makes a variable local in just one buffer.
+This globally affects all uses of this variable, so it belongs together with
+the variable declaration, rather than with its uses (if you just want to make
+a variable local to the current buffer for one particular use, use
+`make-local-variable').  Buffer-local bindings are normally cleared
+while setting up a new major mode, unless they have a `permanent-local'
+property.
 
 The function `default-value' gets the default value and `set-default' sets it.  */)
   (register Lisp_Object variable)
@@ -3018,96 +3022,100 @@ enum bool_vector_op { bool_vector_exclusive_or,
                       bool_vector_subsetp };
 
 static Lisp_Object
-bool_vector_binop_driver (Lisp_Object op1,
-                          Lisp_Object op2,
+bool_vector_binop_driver (Lisp_Object a,
+                          Lisp_Object b,
                           Lisp_Object dest,
                           enum bool_vector_op op)
 {
   EMACS_INT nr_bits;
-  bits_word *adata, *bdata, *cdata;
+  bits_word *adata, *bdata, *destdata;
   ptrdiff_t i = 0;
   ptrdiff_t nr_words;
 
-  CHECK_BOOL_VECTOR (op1);
-  CHECK_BOOL_VECTOR (op2);
+  CHECK_BOOL_VECTOR (a);
+  CHECK_BOOL_VECTOR (b);
 
-  nr_bits = bool_vector_size (op1);
-  if (bool_vector_size (op2) != nr_bits)
-    wrong_length_argument (op1, op2, dest);
+  nr_bits = bool_vector_size (a);
+  if (bool_vector_size (b) != nr_bits)
+    wrong_length_argument (a, b, dest);
 
   nr_words = bool_vector_words (nr_bits);
-  bdata = bool_vector_data (op1);
-  cdata = bool_vector_data (op2);
+  adata = bool_vector_data (a);
+  bdata = bool_vector_data (b);
 
   if (NILP (dest))
     {
       dest = make_uninit_bool_vector (nr_bits);
-      adata = bool_vector_data (dest);
+      destdata = bool_vector_data (dest);
     }
   else
     {
       CHECK_BOOL_VECTOR (dest);
-      adata = bool_vector_data (dest);
+      destdata = bool_vector_data (dest);
       if (bool_vector_size (dest) != nr_bits)
-       wrong_length_argument (op1, op2, dest);
+       wrong_length_argument (a, b, dest);
 
       switch (op)
        {
        case bool_vector_exclusive_or:
-         while (adata[i] == (bdata[i] ^ cdata[i]))
-           if (! (++i < nr_words))
-             return Qnil;
+         for (; i < nr_words; i++)
+           if (destdata[i] != (adata[i] ^ bdata[i]))
+             goto set_dest;
          break;
 
        case bool_vector_subsetp:
-       case bool_vector_union:
-         while (adata[i] == (bdata[i] | cdata[i]))
-           if (! (++i < nr_words))
+         for (; i < nr_words; i++)
+           if (adata[i] &~ bdata[i])
              return Qnil;
+         return Qt;
+
+       case bool_vector_union:
+         for (; i < nr_words; i++)
+           if (destdata[i] != (adata[i] | bdata[i]))
+             goto set_dest;
          break;
 
        case bool_vector_intersection:
-         while (adata[i] == (bdata[i] & cdata[i]))
-           if (! (++i < nr_words))
-             return Qnil;
+         for (; i < nr_words; i++)
+           if (destdata[i] != (adata[i] & bdata[i]))
+             goto set_dest;
          break;
 
        case bool_vector_set_difference:
-         while (adata[i] == (bdata[i] &~ cdata[i]))
-           if (! (++i < nr_words))
-             return Qnil;
+         for (; i < nr_words; i++)
+           if (destdata[i] != (adata[i] &~ bdata[i]))
+             goto set_dest;
          break;
        }
+
+      return Qnil;
     }
 
+ set_dest:
   switch (op)
     {
     case bool_vector_exclusive_or:
-      do
-       adata[i] = bdata[i] ^ cdata[i];
-      while (++i < nr_words);
-      break;
-
-    case bool_vector_subsetp:
+      for (; i < nr_words; i++)
+       destdata[i] = adata[i] ^ bdata[i];
       break;
 
     case bool_vector_union:
-      do
-       adata[i] = bdata[i] | cdata[i];
-      while (++i < nr_words);
+      for (; i < nr_words; i++)
+       destdata[i] = adata[i] | bdata[i];
       break;
 
     case bool_vector_intersection:
-      do
-       adata[i] = bdata[i] & cdata[i];
-      while (++i < nr_words);
+      for (; i < nr_words; i++)
+       destdata[i] = adata[i] & bdata[i];
       break;
 
     case bool_vector_set_difference:
-      do
-       adata[i] = bdata[i] &~ cdata[i];
-      while (++i < nr_words);
+      for (; i < nr_words; i++)
+       destdata[i] = adata[i] &~ bdata[i];
       break;
+
+    default:
+      eassume (0);
     }
 
   return dest;
@@ -3234,11 +3242,11 @@ Return the destination vector if it changed or nil otherwise.  */)
 
 DEFUN ("bool-vector-subsetp", Fbool_vector_subsetp,
        Sbool_vector_subsetp, 2, 2, 0,
-       doc: )
+       doc: /* Return t if every t value in A is also t in B, nil otherwise.
+A and B must be bool vectors of the same length.  */)
   (Lisp_Object a, Lisp_Object b)
 {
-  /* Like bool_vector_union, but doesn't modify b.  */
-  return bool_vector_binop_driver (b, a, b, bool_vector_subsetp);
+  return bool_vector_binop_driver (a, b, b, bool_vector_subsetp);
 }
 
 DEFUN ("bool-vector-not", Fbool_vector_not,