#include <config.h>
#endif
-#define CHARACTER_INLINE EXTERN_INLINE
-
#include <stdio.h>
#ifdef emacs
if (*p < 0x80 || ! (*p & 0x20) || ! (*p & 0x10))
{
+ /* 1-, 2-, and 3-byte sequences can be handled by the macro. */
c = STRING_CHAR_ADVANCE (p);
}
else if (! (*p & 0x08))
{
- c = ((((p)[0] & 0xF) << 18)
+ /* A 4-byte sequence of this form:
+ 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx */
+ c = ((((p)[0] & 0x7) << 18)
| (((p)[1] & 0x3F) << 12)
| (((p)[2] & 0x3F) << 6)
| ((p)[3] & 0x3F));
}
else
{
- c = ((((p)[1] & 0x3F) << 18)
+ /* A 5-byte sequence of this form:
+
+ 111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx
+
+ Note that the top 4 `x's are always 0, so shifting p[1] can
+ never exceed the maximum valid character codepoint. */
+ c = (/* (((p)[0] & 0x3) << 24) ... always 0, so no need to shift. */
+ (((p)[1] & 0x3F) << 18)
| (((p)[2] & 0x3F) << 12)
| (((p)[3] & 0x3F) << 6)
| ((p)[4] & 0x3F));
if (multibyte)
{
- if (byte8_count > (MOST_POSITIVE_FIXNUM - nchars) / 3
- || byte8_count > (STRING_BYTES_BOUND - nbytes) / 2)
+ if ((MOST_POSITIVE_FIXNUM - nchars) / 3 < byte8_count
+ || (STRING_BYTES_BOUND - nbytes) / 2 < byte8_count)
string_overflow ();
/* Convert 2-byte sequence of byte8 chars to 4-byte octal. */
}
else
{
- if (byte8_count > (STRING_BYTES_BOUND - nbytes) / 3)
+ if ((STRING_BYTES_BOUND - nbytes) / 3 < byte8_count)
string_overflow ();
/* Convert 1-byte sequence of byte8 chars to 4-byte octal. */
doc: /* Char table of script symbols.
It has one extra slot whose value is a list of script symbols. */);
- /* Intern this now in case it isn't already done.
- Setting this variable twice is harmless.
- But don't staticpro it here--that is done in alloc.c. */
- Qchar_table_extra_slots = intern_c_string ("char-table-extra-slots");
DEFSYM (Qchar_script_table, "char-script-table");
Fput (Qchar_script_table, Qchar_table_extra_slots, make_number (1));
Vchar_script_table = Fmake_char_table (Qchar_script_table, Qnil);