/* Mark, unmark, query mark bit of a Lisp string. S must be a pointer
to a struct Lisp_String. */
-#define MARK_STRING(S) XMARK ((S)->size)
-#define UNMARK_STRING(S) XUNMARK ((S)->size)
-#define STRING_MARKED_P(S) XMARKBIT ((S)->size)
+#define MARK_STRING(S) ((S)->size |= MARKBIT)
+#define UNMARK_STRING(S) ((S)->size &= ~MARKBIT)
+#define STRING_MARKED_P(S) ((S)->size & MARKBIT)
/* Value is the number of bytes/chars of S, a pointer to a struct
Lisp_String. This must be used instead of STRING_BYTES (S) or
} \
} while (0)
-
+\f
+/* Number support. If NO_UNION_TYPE isn't in effect, we
+ can't create number objects in macros. */
+#ifndef make_number
+Lisp_Object
+make_number (n)
+ int n;
+{
+ Lisp_Object obj;
+ obj.s.val = n;
+ obj.s.type = Lisp_Int;
+ return obj;
+}
+#endif
\f
/***********************************************************************
String Allocation
int nbytes;
{
register Lisp_Object val;
- int nchars = chars_in_text (contents, nbytes);
+ int nchars, multibyte_nbytes;
+
+ parse_str_as_multibyte (contents, nbytes, &nchars, &multibyte_nbytes);
val = make_uninit_multibyte_string (nchars, nbytes);
bcopy (contents, XSTRING (val)->data, nbytes);
- if (STRING_BYTES (XSTRING (val)) == XSTRING (val)->size)
+ if (nbytes == nchars || nbytes != multibyte_nbytes)
+ /* CONTENTS contains no multibyte sequences or contains an invalid
+ multibyte sequence. We must make unibyte string. */
SET_STRING_BYTES (XSTRING (val), -1);
return val;
}
val = make_pure_vector ((EMACS_INT) nargs);
else
val = Fmake_vector (len, Qnil);
+
+ if (STRINGP (args[1]) && STRING_MULTIBYTE (args[1]))
+ /* BYTECODE-STRING must have been produced by Emacs 20.2 or the
+ earlier because they produced a raw 8-bit string for byte-code
+ and now such a byte-code string is loaded as multibyte while
+ raw 8-bit characters converted to multibyte form. Thus, now we
+ must convert them back to the original unibyte form. */
+ args[1] = Fstring_as_unibyte (args[1]);
+
p = XVECTOR (val);
for (index = 0; index < nargs; index++)
{