(fix_submap_inheritance, get_keyelt, store_in_keymap,
[bpt/emacs.git] / src / fns.c
index a723b3f..34015c5 100644 (file)
--- a/src/fns.c
+++ b/src/fns.c
@@ -40,8 +40,6 @@ Boston, MA 02111-1307, USA.  */
 #define NULL (void *)0
 #endif
 
-#define DEFAULT_NONASCII_INSERT_OFFSET 0x800
-
 /* Nonzero enables use of dialog boxes for questions
    asked by mouse commands.  */
 int use_dialog_box;
@@ -125,7 +123,9 @@ To get the number of characters, use `chars-in-string'")
   else if (VECTORP (sequence))
     XSETFASTINT (val, XVECTOR (sequence)->size);
   else if (CHAR_TABLE_P (sequence))
-    XSETFASTINT (val, CHAR_TABLE_ORDINARY_SLOTS);
+    XSETFASTINT (val, (MIN_CHAR_COMPOSITION
+                      + (CHAR_FIELD2_MASK | CHAR_FIELD3_MASK)
+                      - 1));
   else if (BOOL_VECTOR_P (sequence))
     XSETFASTINT (val, XBOOL_VECTOR (sequence)->size);
   else if (COMPILEDP (sequence))
@@ -571,9 +571,9 @@ concat (nargs, args, target_type, last_special)
              break;
            else if (STRINGP (this))
              {
+               int c;
                if (STRING_MULTIBYTE (this))
                  {
-                   int c;
                    FETCH_STRING_CHAR_ADVANCE (c, this,
                                               thisindex,
                                               thisindex_byte);
@@ -581,21 +581,11 @@ concat (nargs, args, target_type, last_special)
                  }
                else
                  {
-                   unsigned char c;
                    XSETFASTINT (elt, XSTRING (this)->data[thisindex++]);
                    if (some_multibyte && XINT (elt) >= 0200
                        && XINT (elt) < 0400)
                      {
-                       c = XINT (elt);
-
-                       if (! NILP (Vnonascii_translate_table))
-                         c = XINT (Faref (Vnonascii_translate_table,
-                                          make_number (c)));
-                       else if (nonascii_insert_offset > 0)
-                         c += nonascii_insert_offset;
-                       else
-                         c += DEFAULT_NONASCII_INSERT_OFFSET;
-
+                       c = unibyte_char_to_multibyte (XINT (elt));
                        XSETINT (elt, c);
                      }
                  }
@@ -791,7 +781,7 @@ string_byte_to_char (string, byte_index)
 }
 \f
 /* Convert STRING to a multibyte string.
-   Single-byte characters 0200 through 0377 are converted
+   Single-byte characters 0240 through 0377 are converted
    by adding nonascii_insert_offset to each.  */
 
 Lisp_Object
@@ -879,8 +869,8 @@ If STRING is multibyte, the result is STRING itself.")
 {
   if (! STRING_MULTIBYTE (string))
     {
-      int newlen = chars_in_text (XSTRING (string)->data,
-                                 XSTRING (string)->size_byte);
+      int newlen = multibyte_chars_in_text (XSTRING (string)->data,
+                                           XSTRING (string)->size_byte);
       /* If all the chars are ASCII, STRING is already suitable.  */
       if (newlen != XSTRING (string)->size_byte)
        {
@@ -1572,7 +1562,7 @@ internal_equal (o1, o2, depth)
            return 1;
          }
        if (WINDOW_CONFIGURATIONP (o1))
-         return compare_window_configurations (o1, o2);
+         return compare_window_configurations (o1, o2, 0);
 
        /* Aside from them, only true vectors, char-tables, and compiled
           functions are sensible to compare, so eliminate the others now.  */
@@ -1852,7 +1842,7 @@ See also the documentation of make-char.")
   c = XINT (ch);
   SPLIT_NON_ASCII_CHAR (c, charset, code1, code2);
   if (! CHARSET_DEFINED_P (charset))
-    error ("Invalid character: %d", c);
+    invalid_character (c);
 
   if (charset == CHARSET_ASCII)
     return (XCHAR_TABLE (char_table)->defalt = value);
@@ -2059,6 +2049,20 @@ mapcar1 (leni, vals, fn, seq)
          vals[i] = call1 (fn, dummy);
        }
     }
+  else if (BOOL_VECTOR_P (seq))
+    {
+      for (i = 0; i < leni; i++)
+       {
+         int byte;
+         byte = XBOOL_VECTOR (seq)->data[i / BITS_PER_CHAR];
+         if (byte & (1 << (i % BITS_PER_CHAR)))
+           dummy = Qt;
+         else
+           dummy = Qnil;
+
+         vals[i] = call1 (fn, dummy);
+       }
+    }
   else if (STRINGP (seq) && ! STRING_MULTIBYTE (seq))
     {
       /* Single-byte string.  */
@@ -2100,7 +2104,8 @@ mapcar1 (leni, vals, fn, seq)
 DEFUN ("mapconcat", Fmapconcat, Smapconcat, 3, 3, 0,
   "Apply FUNCTION to each element of SEQUENCE, and concat the results as strings.\n\
 In between each pair of results, stick in SEPARATOR.  Thus, \" \" as\n\
-SEPARATOR results in spaces between the values returned by FUNCTION.")
+SEPARATOR results in spaces between the values returned by FUNCTION.\n\
+SEQUENCE may be a list, a vector, a bool-vector, or a string.")
   (function, sequence, separator)
      Lisp_Object function, sequence, separator;
 {
@@ -2134,7 +2139,7 @@ SEPARATOR results in spaces between the values returned by FUNCTION.")
 DEFUN ("mapcar", Fmapcar, Smapcar, 2, 2, 0,
   "Apply FUNCTION to each element of SEQUENCE, and make a list of the results.\n\
 The result is a list just as long as SEQUENCE.\n\
-SEQUENCE may be a list, a vector or a string.")
+SEQUENCE may be a list, a vector, a bool-vector, or a string.")
   (function, sequence)
      Lisp_Object function, sequence;
 {