diff options
| author | Xue Fuqiao | 2013-09-04 08:39:34 +0800 |
|---|---|---|
| committer | Xue Fuqiao | 2013-09-04 08:39:34 +0800 |
| commit | adf2fc4a01efe77d73cd52bc9173914ed56ff531 (patch) | |
| tree | a5a280a5554a7bffeaf94fccae29fa3ac1a5d066 /src/character.c | |
| parent | 63191d9f2043d2e67657e85a7b3842805dd1dad6 (diff) | |
| parent | 38726039b77db432989fed106c88e9f1aa463281 (diff) | |
| download | emacs-adf2fc4a01efe77d73cd52bc9173914ed56ff531.tar.gz emacs-adf2fc4a01efe77d73cd52bc9173914ed56ff531.zip | |
Merge from mainline.
Diffstat (limited to 'src/character.c')
| -rw-r--r-- | src/character.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/character.c b/src/character.c index b2caaa290af..6fefb6e8824 100644 --- a/src/character.c +++ b/src/character.c | |||
| @@ -174,11 +174,14 @@ string_char (const unsigned char *p, const unsigned char **advanced, int *len) | |||
| 174 | 174 | ||
| 175 | if (*p < 0x80 || ! (*p & 0x20) || ! (*p & 0x10)) | 175 | if (*p < 0x80 || ! (*p & 0x20) || ! (*p & 0x10)) |
| 176 | { | 176 | { |
| 177 | /* 1-, 2-, and 3-byte sequences can be handled by the macro. */ | ||
| 177 | c = STRING_CHAR_ADVANCE (p); | 178 | c = STRING_CHAR_ADVANCE (p); |
| 178 | } | 179 | } |
| 179 | else if (! (*p & 0x08)) | 180 | else if (! (*p & 0x08)) |
| 180 | { | 181 | { |
| 181 | c = ((((p)[0] & 0xF) << 18) | 182 | /* A 4-byte sequence of this form: |
| 183 | 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx */ | ||
| 184 | c = ((((p)[0] & 0x7) << 18) | ||
| 182 | | (((p)[1] & 0x3F) << 12) | 185 | | (((p)[1] & 0x3F) << 12) |
| 183 | | (((p)[2] & 0x3F) << 6) | 186 | | (((p)[2] & 0x3F) << 6) |
| 184 | | ((p)[3] & 0x3F)); | 187 | | ((p)[3] & 0x3F)); |
| @@ -186,7 +189,14 @@ string_char (const unsigned char *p, const unsigned char **advanced, int *len) | |||
| 186 | } | 189 | } |
| 187 | else | 190 | else |
| 188 | { | 191 | { |
| 189 | c = ((((p)[1] & 0x3F) << 18) | 192 | /* A 5-byte sequence of this form: |
| 193 | |||
| 194 | 111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx | ||
| 195 | |||
| 196 | Note that the top 4 `x's are always 0, so shifting p[1] can | ||
| 197 | never exceed the maximum valid character codepoint. */ | ||
| 198 | c = (/* (((p)[0] & 0x3) << 24) ... always 0, so no need to shift. */ | ||
| 199 | (((p)[1] & 0x3F) << 18) | ||
| 190 | | (((p)[2] & 0x3F) << 12) | 200 | | (((p)[2] & 0x3F) << 12) |
| 191 | | (((p)[3] & 0x3F) << 6) | 201 | | (((p)[3] & 0x3F) << 6) |
| 192 | | ((p)[4] & 0x3F)); | 202 | | ((p)[4] & 0x3F)); |
| @@ -1062,10 +1072,6 @@ A char-table for width (columns) of each character. */); | |||
| 1062 | doc: /* Char table of script symbols. | 1072 | doc: /* Char table of script symbols. |
| 1063 | It has one extra slot whose value is a list of script symbols. */); | 1073 | It has one extra slot whose value is a list of script symbols. */); |
| 1064 | 1074 | ||
| 1065 | /* Intern this now in case it isn't already done. | ||
| 1066 | Setting this variable twice is harmless. | ||
| 1067 | But don't staticpro it here--that is done in alloc.c. */ | ||
| 1068 | Qchar_table_extra_slots = intern_c_string ("char-table-extra-slots"); | ||
| 1069 | DEFSYM (Qchar_script_table, "char-script-table"); | 1075 | DEFSYM (Qchar_script_table, "char-script-table"); |
| 1070 | Fput (Qchar_script_table, Qchar_table_extra_slots, make_number (1)); | 1076 | Fput (Qchar_script_table, Qchar_table_extra_slots, make_number (1)); |
| 1071 | Vchar_script_table = Fmake_char_table (Qchar_script_table, Qnil); | 1077 | Vchar_script_table = Fmake_char_table (Qchar_script_table, Qnil); |